Ask a Question related to Dreamweaver AppDev, Design and Development.
-
PaulCoyney #1
insert data into database
:confused;
Please help, I haven't got a clue what I am doing. I have a page that I wish
people to enter data then submit it to a Microsoft SQL database. When they
submit the data I also want another web page to open showing the the whole
contents of the table. I think my code is a mess and when ever I preview it I
get this error;
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near
','.
/TMPc5b7nd53g8.asp, line 33
For all the good it will do here is my code;
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/directory.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_directory_STRING
Recordset1.Source = "SELECT * FROM dbo.orgtest"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<!--#include file="Connections/directory.asp" -->
<%
if(Request("txtorg") <> "") then Command1__varorgname = Request("txtorg")
if(Request("txttown") <> "") then Command1__vartown = Request("txttown")
%>
<%
'If Err <> 0 then
'Response.Write("Error: " & Err.Description)
%>
<%
set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_directory_STRING
Command1.CommandText = "INSERT INTO dbo.orgtest (orgname, town) VALUES (" +
Replace(Command1__varorgname, "'", "''") + ", " + Replace(Command1__vartown,
"'", "''") + ") "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
%>
<% If Request("Submit") <> "" Then %>
<%
COMMAND CODE
%>
<% End If %>
<form name="form1" method="post" action="inserttest.asp">
<input name="txtorg" type="text" id="txtorg">
<input name="txttown" type="text" id="txttown">
<input type="submit" name="Submit" value="Submit">
</form>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
Any help would be greatly appreciated!
PaulCoyney Guest
-
Using Flash to insert data into a MS Access database
Hi, first of all I am using Flash MX 2004 and have Office 2003. I am trying to use my flash form to insert data into a ms access database but it... -
how to insert data into database from flashform
i have create checkbox in flash form, but i can't use the same name for each value, so i make it cb1, cb2, how should i write the sql statement for... -
how to insert data into database
i already make a form and database with access...and now i want to know how the data will insert automatically into the database...another one, how... -
How to insert datatable data into database at a time
Hi TO All I am doing one task, in that i want to insert datatable data int database at a time.i.e., i am creating one datatable and i a... -
How to INSERT XML data into Oracle database
Hi, Working on a solution where we are using XML as a means to export and import various data. Are Using ADO to save to (export ) XML using... -
Nancy Gill #2
Re: insert data into database
For starters, you have two connection strings in your page .. one on line
two where it should be and another down about 15 lines .. take out the
second one . although there are probably more problems. But start there.
--
Nancy Gill
Team Macromedia Volunteer for Dreamweaver MX/UltraDev
[url]http://www.macromedia.com/go/team/[/url]
Co-Author: Dreamweaver MX: Instant Troubleshooter (August, 2003)
Technical Editor: DMX 2004: The Complete Reference, DMX 2004: A Beginner's
Guide, Mastering Macromedia Contribute
Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP Web Development
"PaulCoyney" <webforumsuser@macromedia.com> wrote in message
news:d0pkpg$mci$1@forums.macromedia.com...wish> :confused;
>
> Please help, I haven't got a clue what I am doing. I have a page that Iit I> people to enter data then submit it to a Microsoft SQL database. When they
> submit the data I also want another web page to open showing the the whole
> contents of the table. I think my code is a mess and when ever I previewnear> get this error;
>
> Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
>
> [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax(" +> ','.
>
> /TMPc5b7nd53g8.asp, line 33
>
> For all the good it will do here is my code;
>
> <%@LANGUAGE="VBSCRIPT"%>
> <!--#include file="Connections/directory.asp" -->
> <%
> Dim Recordset1
> Dim Recordset1_numRows
>
> Set Recordset1 = Server.CreateObject("ADODB.Recordset")
> Recordset1.ActiveConnection = MM_directory_STRING
> Recordset1.Source = "SELECT * FROM dbo.orgtest"
> Recordset1.CursorType = 0
> Recordset1.CursorLocation = 2
> Recordset1.LockType = 1
> Recordset1.Open()
>
> Recordset1_numRows = 0
> %>
> <!--#include file="Connections/directory.asp" -->
> <%
> if(Request("txtorg") <> "") then Command1__varorgname = Request("txtorg")
>
> if(Request("txttown") <> "") then Command1__vartown = Request("txttown")
> %>
> <%
> 'If Err <> 0 then
> 'Response.Write("Error: " & Err.Description)
> %>
> <%
> set Command1 = Server.CreateObject("ADODB.Command")
> Command1.ActiveConnection = MM_directory_STRING
> Command1.CommandText = "INSERT INTO dbo.orgtest (orgname, town) VALUESReplace(Command1__vartown,> Replace(Command1__varorgname, "'", "''") + ", " +> "'", "''") + ") "
> Command1.CommandType = 1
> Command1.CommandTimeout = 0
> Command1.Prepared = true
> Command1.Execute()
>
> %>
> <% If Request("Submit") <> "" Then %>
> <%
> COMMAND CODE
> %>
> <% End If %>
> <form name="form1" method="post" action="inserttest.asp">
> <input name="txtorg" type="text" id="txtorg">
> <input name="txttown" type="text" id="txttown">
> <input type="submit" name="Submit" value="Submit">
> </form>
> <%
> Recordset1.Close()
> Set Recordset1 = Nothing
> %>
>
>
> Any help would be greatly appreciated!
>
Nancy Gill Guest
-
PaulCoyney #3
Re: insert data into database
Thanks for the tip, don't know how I missed that. Must be getting somewhere
cause the error I get is different.
Microsoft VBScript compilation error '800a03f6'
Expected 'End'
/TMP92woqd71p8.asp, line 51
I have not typed any of this code in I have been using insert and the rest to
do it so I do not know what it means by Expected 'End', maybe I should go back
to just fixing computers.
PaulCoyney Guest



Reply With Quote

