Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: RE: Help Updating Database


Message #1 by "Joshua Krause" <jkrause@t...> on Tue, 2 Apr 2002 16:12:58
Okay i did what you sd and added this line:
sqlstring = "UPDATE Contact SET Account = " & Request.Form("Account") &  " 
WHERE ContactID = '" & Request.Form("Contact") & "'"

And this is my error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
/newserver/IP Migration/writeto.asp, line 17

Now i am going to eventually want to be able to update all the fields but 
for now i am just trying to get one to work or two to work and then go 
from there.  Now the Contact_ID field is my Primary Key Field.  So when i 
goto modify that record it knows which one to pull and save to.

> you have the syntax wrong

it should be

sqlstring = "UPDATE Contact SET Account = " & Request.Form("Account") 
&  " WHERE ContactID = '" & Request.Form("Contact") & "'"





-----Original Message-----
From: Joshua Krause [mailto:jkrause@t...]
Sent: Tuesday, April 02, 2002 3:51 PM
To: ASP Databases
Subject: [asp_databases] RE: Help Updating Database


Ok i changed my code to look like this:
sqlstring = "UPDATE Contact " &  "SET Account = " Request.Form("Account") 
&  "WHERE ContactID = 'Contact_ID" & Request.Form("Contact") & "'"

and i get this error:
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/newserver/IP Migration/writeto.asp, line 16, column 50

The fields Account and Contact_ID are numerical fields.

> I assumed you knew that the underscore character was the line
continuation character, but apparently you didn't.

In my last email, I wrote this:

sqlstring = "UPDATE Contact " & _
            "SET Account = " Request.Form("Account") & _
            "WHERE ContactID = 'Contact_ID" & Request.Form("Contact") &
"'"

The above code is on 3 lines, and the _ character tells the ASP to
continue the command on the next line.  If you put it all on one line,
you must remove the underscore.  Your post notes an invalid character at
column 34 because you have the _ there still, but you moved the
following line up onto the same line.  Try it again, just as it appears
above.

Also, you didn't answer the question about what the data types were.  So
I'm still assuming that Account is numeric and ContactID is a text
field.

-Pete


> -----Original Message-----
> From: Joshua Krause [mailto:jkrause@t...]
> Sent: Tuesday, April 02, 2002 12:36 AM
> To: ASP Databases
> Subject: [asp_databases] RE: Help Updating Database
> 
> 
> This is what it looks like with the changes
> sqlstring = "UPDATE Contact " & _ "SET Account = " 
> Request.Form("Account") 
> & _ "WHERE ContactID = 'Contact_ID" & Request.Form("Contact") & "'"
> 
> This is the error:
> Error Type:
> Microsoft VBScript compilation (0x800A0408)
> Invalid character
> /newserver/IP Migration/writeto.asp, line 16, column 34
> 
> The Name of the Access Database is Contact.
> The Fields in the Access Database are:
> Account                 CMTS
> Customer                GW_IP   
> Street_Address          Start
> Phone                   NAT_GW_IP
> Batch                   Port_Fwds
> Technical_Contact       DHCP 
> Email                   Persistent_DHCP_or_Static_IP
> Old_IP                  Notes
> New_IP                  Updated_by
> MAC_Addy                Date_Updated 
> Node 
> 
> My database is full of Business Customers that may have some 
> fields filled 
> out.  I am trying to make it to where my co workers can goto 
> a html based 
> site and pull up anyone of the customers.  And then be able 
> to click Add 
> or Modify and make changes or additions to the data base.  
> And this is the 
> only page killin me.
> 
> 
> > Did you get rid of that trailing "Line 16" at the end?
> 
> Also, what data type is Account?  Also, is the ContactID form a text
> field in the database?  If so, then your WHERE clause should look like
> this:
> 
> WHERE ContactID = 'Contact_ID" & Request.Form("Contact") & "'"
> 
> If not, then this statement doesn't make any sense, because the
> "Contact_ID" portion is a string, not a number.  Try something like
> this:
> 
> sqlstring = "UPDATE Contact " & _
>             "SET Account = " Request.Form("Account") & _
>             "WHERE ContactID = 'Contact_ID" & 
> Request.Form("Contact") &
> "'"
> 
> 
> > -----Original Message-----
> > From: Joshua Krause [mailto:jkrause@t...]
> > Sent: Monday, April 01, 2002 11:46 PM
> > To: ASP Databases
> > Subject: [asp_databases] RE: Help Updating Database
> > 
> > 
> > Ok so now it looks like this 
> > sqlstring = "UPDATE Contact SET Account = " & 
> > Request.Form("Account") & " 
> > WHERE ContactID = Contact_ID" & Request.Form("Contact")   Line 16
> > 
> > but now i get this error message
> > Error Type:
> > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> > [Microsoft][ODBC Microsoft Access Driver] Syntax error in 
> > UPDATE statement.
> > /newserver/IP Migration/writeto.asp, line 17
> > 
> > 
> > > You forgot to end your string before 
> > Request.Form("Account") and after
> > it.
> > " & Request.Form("Account") & "
> > 
> > -Pete
> > 
> > > -----Original Message-----
> > > From: Joshua Krause [mailto:jkrause@t...]
> > > Sent: Monday, April 01, 2002 11:29 PM
> > > To: ASP Databases
> > > Subject: [asp_databases] Help Updating Database
> > > 
> > > 
> > > I am having an issue updating an Access Database using ASP.
> > > This is my error message:
> > > Error Type:
> > > Microsoft VBScript compilation (0x800A0401)
> > > Expected end of statement
> > > /newserver/IP Migration/writeto.asp, line 16, column 56
> > > 
> > > Here is my code:
> > > 
> > > <%@ Language="VBScript" %>
> > > <%
> > > 	Set RRConn = Server.CreateObject("ADODB.Connection")
> > > 	RRConnstring = "DSN=Contact; UID=; PWD="
> > > 	RRConn.Open(RRConnstring)
> > > 
> > > 	If Request.Form("Type") = "Delete" Then
> > > 		Set rrRst = Server.CreateObject("ADODB.Recordset")
> > > 		sqlstring = "DELETE FROM [Contact] WHERE 
> > > [Contact_ID] =" & 
> > > Request.Form("Contact")
> > > 		rrRst.Open sqlstring, RRConn, 3, 3
> > > 		RRConn.Close
> > > 		Response.Write "<center><b>Record was 
> > > deleted</center></b>"
> > > 	End If
> > > 	If Request.Form("Type") = "Modify" Then
> > > 		Set rrRst = Server.CreateObject("ADODB.Recordset")
> > > 		sqlstring = "UPDATE Contact SET Account = Request.Form
> > > ("Account") WHERE ContactID = Contact_ID" & 
> > > Request.Form("Contact") Line 16
> > > 		rrRst.Open sqlstring, RRConn, 3, 3
> > > 		rrRst.Fields("Account") = Request.Form("Account")
> > > 		rrRst.Fields("Customer") = Request.Form("Customer")
> > > 		rrRst.Fields("Street_Address") = Request.Form
> > > ("Street_Address")
> > > 		rrRst.Fields("Phone") = Request.Form("Phone")
> > > 		rrRst.Fields("Batch") = Request.Form("Batch")
> > > 		rrRst.Fields("Technical_Contact") = Request.Form
> > > ("Technical_Contact")
> > > 		rrRst.Fields("Email") = Request.Form("Email")
> > > 		rrRst.Fields("Old_IP") = Request.Form("Old_IP")
> > > 		rrRst.Fields("New_IP") = Request.Form("New_IP")
> > > 		rrRst.Fields("MAC_Addy") = Request.Form("MAC_Addy")
> > > 		rrRst.Fields("Node") = Request.Form("Node")
> > > 		rrRst.Fields("CMTS") = Request.Form("CMTS")
> > > 		rrRst.Fields("GW_IP") = Request.Form("GW_IP")
> > > 		rrRst.Fields("Start") = Request.Form("Start")
> > > 		rrRst.Fields("NAT_GW_IP") = Request.Form("NAT_GW_IP")
> > > 		rrRst.Fields("Port_Fwds") = Request.Form("Port_Fwds")
> > > 		rrRst.Fields("DHCP") = Request.Form("DHCP")
> > > 		rrRst.Fields("Persistent_DHCP_or_Static_IP") = 
> > > Request.Form
> > > ("Persistent_DHCP_or_Static_IP")
> > > 		rrRst.Fields("Notes") = Request.Form("Notes")
> > > 		rrRst.Fields("Updated_by") = Request.Form("Updated_by")
> > > 		rrRst.Fields("Date_Updated") = 
> > > Request.Form("Date_Updated")
> > > 		rrRst.Update
> > > 		rrRst.Close
> > > 	   ' Set MyRst = Nothing
> > > 		RRConn.Close
> > > 		'Set MyConn = Nothing
> > > 		Response.Write "<b><center>Record was 
> > > modified</center></b>"
> > > 	End If
> > > 	If Request.Form("Type") = "Add" Then
> > > 		Set rrRst = Server.CreateObject("ADODB.Recordset")
> > > 		sqlstring = "SELECT * FROM [Contact] "
> > > 		rrRst.Open sqlstring, RRConn, 3, 3
> > > 		rrRst.AddNew
> > > 		rrRst.Fields("Account") = Request.Form("Account")
> > > 		rrRst.Fields("Customer") = Request.Form("Customer")
> > > 		rrRst.Fields("Street_Address") = Request.Form
> > > ("Street_Address")
> > > 		rrRst.Fields("Phone") = Request.Form("Phone")
> > > 		rrRst.Fields("Batch") = Request.Form("Batch")
> > > 		rrRst.Fields("Technical_Contact") = Request.Form
> > > ("Technical_Contact")
> > > 		rrRst.Fields("Email") = Request.Form("Email")
> > > 		rrRst.Fields("Old_IP") = Request.Form("Old_IP")
> > > 		rrRst.Fields("New_IP") = Request.Form("New_IP")
> > > 		rrRst.Fields("MAC_Addy") = Request.Form("MAC_Addy")
> > > 		rrRst.Fields("Node") = Request.Form("Node")
> > > 		rrRst.Fields("CMTS") = Request.Form("CMTS")
> > > 		rrRst.Fields("GW_IP") = Request.Form("GW_IP")
> > > 		rrRst.Fields("Start") = Request.Form("Start")
> > > 		rrRst.Fields("NAT_GW_IP") = Request.Form("NAT_GW_IP")
> > > 		rrRst.Fields("Port_Fwds") = Request.Form("Port_Fwds")
> > > 		rrRst.Fields("DHCP") = Request.Form("DHCP")
> > > 		rrRst.Fields("Persistent_DHCP_or_Static_IP") = 
> > > Request.Form
> > > ("Persistent_DHCP_or_Static_IP")
> > > 		rrRst.Fields("Notes") = Request.Form("Notes")
> > > 		rrRst.Fields("Updated_by") = Request.Form("Updated_by")
> > > 		rrRst.Fields("Date_Updated") = 
> > > Request.Form("Date_Updated")
> > > 		rrRst.Update
> > > 		rrRst.Close
> > > 		'Set MyRst = Nothing
> > > 		RRConn.Close
> > > 		'Set MyConn = Nothing
> > > 		Response.Write"<center><b>Record was added</b></center>"
> > > 		
> > > 	End If
> > > 	'MyConn.Close
> > > 	'Set MyConn = Nothing
> > > 	%> 
> > > 		
> > > 
> > > 	
> > > 
> > > <html>
> > > 
> > > <head>
> > > <title>Write to DB</title>
> > > </head>
> > > 
> > > <body bgcolor="white">
> > > 
> > > <p align="center">Please Follow Link back to welcome page </p>
> > > <p align="center">&nbsp;</p>
> > > <p align="center"><a href="welcome.asp">Home</a></p>
> > > 
> > > </body>
> > > 
> > > </html>
> > > 
> > > Can someone tell me what i need to do or am doing wrong in 
> > > order to be 
> > > able to update my fields in my database?
> > > 
> > 
> 
Message #2 by "Joshua Krause" <jkrause@t...> on Mon, 1 Apr 2002 23:29:07
I am having an issue updating an Access Database using ASP.
This is my error message:
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/newserver/IP Migration/writeto.asp, line 16, column 56

Here is my code:

<%@ Language="VBScript" %>
<%
	Set RRConn = Server.CreateObject("ADODB.Connection")
	RRConnstring = "DSN=Contact; UID=; PWD="
	RRConn.Open(RRConnstring)

	If Request.Form("Type") = "Delete" Then
		Set rrRst = Server.CreateObject("ADODB.Recordset")
		sqlstring = "DELETE FROM [Contact] WHERE [Contact_ID] =" & 
Request.Form("Contact")
		rrRst.Open sqlstring, RRConn, 3, 3
		RRConn.Close
		Response.Write "<center><b>Record was deleted</center></b>"
	End If
	If Request.Form("Type") = "Modify" Then
		Set rrRst = Server.CreateObject("ADODB.Recordset")
		sqlstring = "UPDATE Contact SET Account = Request.Form
("Account") WHERE ContactID = Contact_ID" & Request.Form("Contact") Line 16
		rrRst.Open sqlstring, RRConn, 3, 3
		rrRst.Fields("Account") = Request.Form("Account")
		rrRst.Fields("Customer") = Request.Form("Customer")
		rrRst.Fields("Street_Address") = Request.Form
("Street_Address")
		rrRst.Fields("Phone") = Request.Form("Phone")
		rrRst.Fields("Batch") = Request.Form("Batch")
		rrRst.Fields("Technical_Contact") = Request.Form
("Technical_Contact")
		rrRst.Fields("Email") = Request.Form("Email")
		rrRst.Fields("Old_IP") = Request.Form("Old_IP")
		rrRst.Fields("New_IP") = Request.Form("New_IP")
		rrRst.Fields("MAC_Addy") = Request.Form("MAC_Addy")
		rrRst.Fields("Node") = Request.Form("Node")
		rrRst.Fields("CMTS") = Request.Form("CMTS")
		rrRst.Fields("GW_IP") = Request.Form("GW_IP")
		rrRst.Fields("Start") = Request.Form("Start")
		rrRst.Fields("NAT_GW_IP") = Request.Form("NAT_GW_IP")
		rrRst.Fields("Port_Fwds") = Request.Form("Port_Fwds")
		rrRst.Fields("DHCP") = Request.Form("DHCP")
		rrRst.Fields("Persistent_DHCP_or_Static_IP") = Request.Form
("Persistent_DHCP_or_Static_IP")
		rrRst.Fields("Notes") = Request.Form("Notes")
		rrRst.Fields("Updated_by") = Request.Form("Updated_by")
		rrRst.Fields("Date_Updated") = Request.Form("Date_Updated")
		rrRst.Update
		rrRst.Close
	   ' Set MyRst = Nothing
		RRConn.Close
		'Set MyConn = Nothing
		Response.Write "<b><center>Record was 
modified</center></b>"
	End If
	If Request.Form("Type") = "Add" Then
		Set rrRst = Server.CreateObject("ADODB.Recordset")
		sqlstring = "SELECT * FROM [Contact] "
		rrRst.Open sqlstring, RRConn, 3, 3
		rrRst.AddNew
		rrRst.Fields("Account") = Request.Form("Account")
		rrRst.Fields("Customer") = Request.Form("Customer")
		rrRst.Fields("Street_Address") = Request.Form
("Street_Address")
		rrRst.Fields("Phone") = Request.Form("Phone")
		rrRst.Fields("Batch") = Request.Form("Batch")
		rrRst.Fields("Technical_Contact") = Request.Form
("Technical_Contact")
		rrRst.Fields("Email") = Request.Form("Email")
		rrRst.Fields("Old_IP") = Request.Form("Old_IP")
		rrRst.Fields("New_IP") = Request.Form("New_IP")
		rrRst.Fields("MAC_Addy") = Request.Form("MAC_Addy")
		rrRst.Fields("Node") = Request.Form("Node")
		rrRst.Fields("CMTS") = Request.Form("CMTS")
		rrRst.Fields("GW_IP") = Request.Form("GW_IP")
		rrRst.Fields("Start") = Request.Form("Start")
		rrRst.Fields("NAT_GW_IP") = Request.Form("NAT_GW_IP")
		rrRst.Fields("Port_Fwds") = Request.Form("Port_Fwds")
		rrRst.Fields("DHCP") = Request.Form("DHCP")
		rrRst.Fields("Persistent_DHCP_or_Static_IP") = Request.Form
("Persistent_DHCP_or_Static_IP")
		rrRst.Fields("Notes") = Request.Form("Notes")
		rrRst.Fields("Updated_by") = Request.Form("Updated_by")
		rrRst.Fields("Date_Updated") = Request.Form("Date_Updated")
		rrRst.Update
		rrRst.Close
		'Set MyRst = Nothing
		RRConn.Close
		'Set MyConn = Nothing
		Response.Write"<center><b>Record was added</b></center>"
		
	End If
	'MyConn.Close
	'Set MyConn = Nothing
	%> 
		

	

<html>

<head>
<title>Write to DB</title>
</head>

<body bgcolor="white">

<p align="center">Please Follow Link back to welcome page </p>
<p align="center">&nbsp;</p>
<p align="center"><a href="welcome.asp">Home</a></p>

</body>

</html>

Can someone tell me what i need to do or am doing wrong in order to be 
able to update my fields in my database?
Message #3 by "Drew, Ron" <RDrew@B...> on Tue, 2 Apr 2002 17:04:14 -0500
One SET not two
UPDATE Contact SET Account =3D '300520-01', Customer =3D 'American 
Webbing &
Fitting' WHERE Contact_ID =3D 53;

-----Original Message-----
From: Joshua Krause [mailto:jkrause@t...]
Sent: Tuesday, April 02, 2002 2:03 PM
To: ASP Databases
Subject: [asp_databases] RE: Help Updating Database


sqlstring =3D "UPDATE Contact SET Account =3D '" & 
Request.Form("Account") &
"' SET Customer =3D '" & Request.Form("Customer") & "' WHERE Contact_ID 
=3D
" &
Request.Form("Contact")


I got it to work with the first two which is Account and Contact_ID.
Now i am throwing in the Customer field which is a text field.  I ran
the response.write sqlstring and i get this UPDATE Contact SET Account 
=3D
'300520-01' SET Customer =3D 'American Webbing & Fitting' WHERE 
Contact_ID
=3D 53

And then i go into Access and the database and run a sql query on it and
i get this Syntax error (missing operator) in query expression
"300520-01' SET Customer =3D 'American Webbing & Fitting".

Joshua
Tech #10190
High Speed Data Services
Time Warner Cable - Greensboro Division

----- Original Message -----
From: "Breidenbach, Beth" <Beth.Breidenbach@g...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, April 02, 2002 11:28 AM
Subject: [asp_databases] RE: Help Updating Database


Joshua, use a Response.Write to output your fully-built query string to
the web page.

Next, use Access's query builder to create the same query and use the
View, SQLView option from the Access menu -- it'll show you the SQL
generated by Access.

You should then be able to compare and determine the difference between
the access-generated query and the query you created.

If you still can't get it to work, send us BOTH queries -- the
ASP-generated and the Access-generated.

Beth

-----Original Message-----
From: Joshua Krause [mailto:jkrause@t...]
Sent: Tuesday, April 02, 2002 8:26 AM
To: ASP Databases
Subject: [asp_databases] RE: Help Updating Database


Don't know how to do that?  The data is setup in Access in all the
different fields as listed below.  With no quotes whatsoever.  The data
is then pulled from the Access Database.  I can get the data to display
in my table just fine.  But i have a modify option to where i want to be
able to modify certain fields that might not have any data and need to
enter.  Or just need to update data that is currently in the field.  But
like i said all my other pages work fine even my delete option is
working just not my add and modify options.  Which are all on the
writeto.asp page.

Joshua
Tech #10190
High Speed Data Services
Time Warner Cable - Greensboro Division

----- Original Message -----
From: "Meinken, Joe" <Joe.Meinken@q...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, April 02, 2002 10:50 AM
Subject: [asp_databases] RE: Help Updating Database


> How are you sending the data?  With quotes around it?  Without quotes?
How
> is this field set up in the table you're trying to update?  Have you
> attempted to output the sqlstring variable, copied it out of the
> browser
and
> attempted to run it through Acess?
>
> -----Original Message-----
> From: Joshua Krause [mailto:jkrause@t...]
> Sent: Tuesday, April 02, 2002 10:13 AM
> To: ASP Databases
> Subject: [asp_databases] RE: Help Updating Database
>
>
> Okay i did what you sd and added this line:
> sqlstring =3D "UPDATE Contact SET Account =3D " & 
Request.Form("Account")
> &  " WHERE ContactID =3D '" & Request.Form("Contact") & "'"
>
> And this is my error:
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
statement.
> /newserver/IP Migration/writeto.asp, line 17
>
> Now i am going to eventually want to be able to update all the fields
> but for now i am just trying to get one to work or two to work and
> then go from there.  Now the Contact_ID field is my Primary Key Field.

> So when i goto modify that record it knows which one to pull and save
> to.
>
> > you have the syntax wrong
>
> it should be
>
> sqlstring =3D "UPDATE Contact SET Account =3D " & 
Request.Form("Account")
> &  " WHERE ContactID =3D '" & Request.Form("Contact") & "'"
>
>
>
>
>
> -----Original Message-----
> From: Joshua Krause [mailto:jkrause@t...]
> Sent: Tuesday, April 02, 2002 3:51 PM
> To: ASP Databases
> Subject: [asp_databases] RE: Help Updating Database
>
>
> Ok i changed my code to look like this:
> sqlstring =3D "UPDATE Contact " &  "SET Account =3D "
> Request.Form("Account") &  "WHERE ContactID =3D 'Contact_ID" &
> Request.Form("Contact") & "'"
>
> and i get this error:
> Error Type:
> Microsoft VBScript compilation (0x800A0401)
> Expected end of statement
> /newserver/IP Migration/writeto.asp, line 16, column 50
>
> The fields Account and Contact_ID are numerical fields.
>
> > I assumed you knew that the underscore character was the line
> continuation character, but apparently you didn't.
>
> In my last email, I wrote this:
>
> sqlstring =3D "UPDATE Contact " & _
>             "SET Account =3D " Request.Form("Account") & _
>             "WHERE ContactID =3D 'Contact_ID" & 
Request.Form("Contact")
> & "'"
>
> The above code is on 3 lines, and the _ character tells the ASP to
> continue the command on the next line.  If you put it all on one line,

> you must remove the underscore.  Your post notes an invalid character
> at column 34 because you have the _ there still, but you moved the
> following line up onto the same line.  Try it again, just as it
> appears above.
>
> Also, you didn't answer the question about what the data types were. 
> So I'm still assuming that Account is numeric and ContactID is a text
> field.
>
> -Pete
>
>
> > -----Original Message-----
> > From: Joshua Krause [mailto:jkrause@t...]
> > Sent: Tuesday, April 02, 2002 12:36 AM
> > To: ASP Databases
> > Subject: [asp_databases] RE: Help Updating Database
> >
> >
> > This is what it looks like with the changes
> > sqlstring =3D "UPDATE Contact " & _ "SET Account =3D "
> > Request.Form("Account")
> > & _ "WHERE ContactID =3D 'Contact_ID" & Request.Form("Contact") & 
"'"
> >
> > This is the error:
> > Error Type:
> > Microsoft VBScript compilation (0x800A0408)
> > Invalid character
> > /newserver/IP Migration/writeto.asp, line 16, column 34
> >
> > The Name of the Access Database is Contact.
> > The Fields in the Access Database are:
> > Account                 CMTS
> > Customer                GW_IP
> > Street_Address          Start
> > Phone                   NAT_GW_IP
> > Batch                   Port_Fwds
> > Technical_Contact       DHCP
> > Email                   Persistent_DHCP_or_Static_IP
> > Old_IP                  Notes
> > New_IP                  Updated_by
> > MAC_Addy                Date_Updated
> > Node
> >
> > My database is full of Business Customers that may have some fields
> > filled out.  I am trying to make it to where my co workers can goto
> > a html based
> > site and pull up anyone of the customers.  And then be able
> > to click Add
> > or Modify and make changes or additions to the data base.
> > And this is the
> > only page killin me.
> >
> >
> > > Did you get rid of that trailing "Line 16" at the end?
> >
> > Also, what data type is Account?  Also, is the ContactID form a text

> > field in the database?  If so, then your WHERE clause should look
> > like
> > this:
> >
> > WHERE ContactID =3D 'Contact_ID" & Request.Form("Contact") & "'"
> >
> > If not, then this statement doesn't make any sense, because the
> > "Contact_ID" portion is a string, not a number.  Try something like
> > this:
> >
> > sqlstring =3D "UPDATE Contact " & _
> >             "SET Account =3D " Request.Form("Account") & _
> >             "WHERE ContactID =3D 'Contact_ID" &
> > Request.Form("Contact") &
> > "'"
> >
> >
> > > -----Original Message-----
> > > From: Joshua Krause [mailto:jkrause@t...]
> > > Sent: Monday, April 01, 2002 11:46 PM
> > > To: ASP Databases
> > > Subject: [asp_databases] RE: Help Updating Database
> > >
> > >
> > > Ok so now it looks like this
> > > sqlstring =3D "UPDATE Contact SET Account =3D " &
> > > Request.Form("Account") & "
> > > WHERE ContactID =3D Contact_ID" & Request.Form("Contact")   Line 
16
> > >
> > > but now i get this error message
> > > Error Type:
> > > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> > > [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
> > > statement. /newserver/IP Migration/writeto.asp, line 17
> > >
> > >
> > > > You forgot to end your string before
> > > Request.Form("Account") and after
> > > it.
> > > " & Request.Form("Account") & "
> > >
> > > -Pete
> > >
> > > > -----Original Message-----
> > > > From: Joshua Krause [mailto:jkrause@t...]
> > > > Sent: Monday, April 01, 2002 11:29 PM
> > > > To: ASP Databases
> > > > Subject: [asp_databases] Help Updating Database
> > > >
> > > >
> > > > I am having an issue updating an Access Database using ASP. This

> > > > is my error message: Error Type:
> > > > Microsoft VBScript compilation (0x800A0401)
> > > > Expected end of statement
> > > > /newserver/IP Migration/writeto.asp, line 16, column 56
> > > >
> > > > Here is my code:
> > > >
> > > > <%@ Language=3D"VBScript" %>
> > > > <%
> > > > Set RRConn =3D Server.CreateObject("ADODB.Connection")
> > > > RRConnstring =3D "DSN=3DContact; UID=3D; PWD=3D"
> > > > RRConn.Open(RRConnstring)
> > > >
> > > > If Request.Form("Type") =3D "Delete" Then
> > > > Set rrRst =3D Server.CreateObject("ADODB.Recordset")
> > > > sqlstring =3D "DELETE FROM [Contact] WHERE
> > > > [Contact_ID] =3D" &
> > > > Request.Form("Contact")
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > RRConn.Close
> > > > Response.Write "<center><b>Record was deleted</center></b>"
> > > > End If
> > > > If Request.Form("Type") =3D "Modify" Then
> > > > Set rrRst =3D Server.CreateObject("ADODB.Recordset")
> > > > sqlstring =3D "UPDATE Contact SET Account =3D Request.Form
> > > > ("Account") WHERE ContactID =3D Contact_ID" &
> > > > Request.Form("Contact") Line 16
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > rrRst.Fields("Account") =3D Request.Form("Account")
> > > > rrRst.Fields("Customer") =3D Request.Form("Customer")
> > > > rrRst.Fields("Street_Address") =3D Request.Form
> > > > ("Street_Address")
> > > > rrRst.Fields("Phone") =3D Request.Form("Phone")
> > > > rrRst.Fields("Batch") =3D Request.Form("Batch")
> > > > rrRst.Fields("Technical_Contact") =3D Request.Form
> > > > ("Technical_Contact")
> > > > rrRst.Fields("Email") =3D Request.Form("Email")
> > > > rrRst.Fields("Old_IP") =3D Request.Form("Old_IP")
> > > > rrRst.Fields("New_IP") =3D Request.Form("New_IP")
> > > > rrRst.Fields("MAC_Addy") =3D Request.Form("MAC_Addy")
> > > > rrRst.Fields("Node") =3D Request.Form("Node")
> > > > rrRst.Fields("CMTS") =3D Request.Form("CMTS")
> > > > rrRst.Fields("GW_IP") =3D Request.Form("GW_IP")
> > > > rrRst.Fields("Start") =3D Request.Form("Start")
> > > > rrRst.Fields("NAT_GW_IP") =3D Request.Form("NAT_GW_IP")
> > > > rrRst.Fields("Port_Fwds") =3D Request.Form("Port_Fwds")
> > > > rrRst.Fields("DHCP") =3D Request.Form("DHCP")
> > > > rrRst.Fields("Persistent_DHCP_or_Static_IP") =3D
> > > > Request.Form
> > > > ("Persistent_DHCP_or_Static_IP")
> > > > rrRst.Fields("Notes") =3D Request.Form("Notes")
> > > > rrRst.Fields("Updated_by") =3D Request.Form("Updated_by")
> > > > rrRst.Fields("Date_Updated") =3D
> > > > Request.Form("Date_Updated")
> > > > rrRst.Update
> > > > rrRst.Close
> > > >    ' Set MyRst =3D Nothing
> > > > RRConn.Close
> > > > 'Set MyConn =3D Nothing
> > > > Response.Write "<b><center>Record was
> > > > modified</center></b>"
> > > > End If
> > > > If Request.Form("Type") =3D "Add" Then
> > > > Set rrRst =3D Server.CreateObject("ADODB.Recordset")
> > > > sqlstring =3D "SELECT * FROM [Contact] "
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > rrRst.AddNew
> > > > rrRst.Fields("Account") =3D Request.Form("Account")
> > > > rrRst.Fields("Customer") =3D Request.Form("Customer")
> > > > rrRst.Fields("Street_Address") =3D Request.Form
> > > > ("Street_Address")
> > > > rrRst.Fields("Phone") =3D Request.Form("Phone")
> > > > rrRst.Fields("Batch") =3D Request.Form("Batch")
> > > > rrRst.Fields("Technical_Contact") =3D Request.Form
> > > > ("Technical_Contact")
> > > > rrRst.Fields("Email") =3D Request.Form("Email")
> > > > rrRst.Fields("Old_IP") =3D Request.Form("Old_IP")
> > > > rrRst.Fields("New_IP") =3D Request.Form("New_IP")
> > > > rrRst.Fields("MAC_Addy") =3D Request.Form("MAC_Addy")
> > > > rrRst.Fields("Node") =3D Request.Form("Node")
> > > > rrRst.Fields("CMTS") =3D Request.Form("CMTS")
> > > > rrRst.Fields("GW_IP") =3D Request.Form("GW_IP")
> > > > rrRst.Fields("Start") =3D Request.Form("Start")
> > > > rrRst.Fields("NAT_GW_IP") =3D Request.Form("NAT_GW_IP")
> > > > rrRst.Fields("Port_Fwds") =3D Request.Form("Port_Fwds")
> > > > rrRst.Fields("DHCP") =3D Request.Form("DHCP")
> > > > rrRst.Fields("Persistent_DHCP_or_Static_IP") =3D
> > > > Request.Form
> > > > ("Persistent_DHCP_or_Static_IP")
> > > > rrRst.Fields("Notes") =3D Request.Form("Notes")
> > > > rrRst.Fields("Updated_by") =3D Request.Form("Updated_by")
> > > > rrRst.Fields("Date_Updated") =3D
> > > > Request.Form("Date_Updated")
> > > > rrRst.Update
> > > > rrRst.Close
> > > > 'Set MyRst =3D Nothing
> > > > RRConn.Close
> > > > 'Set MyConn =3D Nothing
> > > > Response.Write"<center><b>Record was added</b></center>"
> > > >
> > > > End If
> > > > 'MyConn.Close
> > > > 'Set MyConn =3D Nothing
> > > > %>
> > > >
> > > >
> > > >
> > > >
> > > > <html>
> > > >
> > > > <head>
> > > > <title>Write to DB</title>
> > > > </head>
> > > >
> > > > <body bgcolor=3D"white">
> > > >
> > > > <p align=3D"center">Please Follow Link back to welcome page </p> 

> > > > <p align=3D"center">&nbsp;</p> <p align=3D"center"><a
> > > > href=3D"welcome.asp">Home</a></p>
> > > >
> > > > </body>
> > > >
> > > > </html>
> > > >
> > > > Can someone tell me what i need to do or am doing wrong in order

> > > > to be able to update my fields in my database?
> > > >
> > > ---
> > > Change your mail options at http://p2p.wrox.com/manager.asp or to
> > > unsubscribe send a blank email to 
> > >
> > ---
> > Change your mail options at http://p2p.wrox.com/manager.asp or to
> > unsubscribe send a blank email to 
> >
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or to
> unsubscribe send a blank email to 
>
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or to
> unsubscribe send a blank email to


---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 

---
Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to 


Message #4 by "Meinken, Joe" <Joe.Meinken@q...> on Tue, 2 Apr 2002 10:36:51 -0600
If you're writing your page using VBScript, use some response.write's
(document.write's for JavaScript).  You should then be able to key in this
sql almost verbatim in Access.

-----Original Message-----
From: Joshua Krause [mailto:jkrause@t...]
Sent: Tuesday, April 02, 2002 10:26 AM
To: ASP Databases
Subject: [asp_databases] RE: Help Updating Database


Don't know how to do that?  The data is setup in Access in all the different
fields as listed below.  With no quotes whatsoever.  The data is then pulled
from the Access Database.  I can get the data to display in my table just
fine.  But i have a modify option to where i want to be able to modify
certain fields that might not have any data and need to enter.  Or just need
to update data that is currently in the field.  But like i said all my other
pages work fine even my delete option is working just not my add and modify
options.  Which are all on the writeto.asp page.

Joshua
Tech #10190
High Speed Data Services
Time Warner Cable - Greensboro Division

----- Original Message -----
From: "Meinken, Joe" <Joe.Meinken@q...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, April 02, 2002 10:50 AM
Subject: [asp_databases] RE: Help Updating Database


> How are you sending the data?  With quotes around it?  Without quotes?
How
> is this field set up in the table you're trying to update?  Have you
> attempted to output the sqlstring variable, copied it out of the browser
and
> attempted to run it through Acess?
>
> -----Original Message-----
> From: Joshua Krause [mailto:jkrause@t...]
> Sent: Tuesday, April 02, 2002 10:13 AM
> To: ASP Databases
> Subject: [asp_databases] RE: Help Updating Database
>
>
> Okay i did what you sd and added this line:
> sqlstring = "UPDATE Contact SET Account = " & Request.Form("Account") &  "
> WHERE ContactID = '" & Request.Form("Contact") & "'"
>
> And this is my error:
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
statement.
> /newserver/IP Migration/writeto.asp, line 17
>
> Now i am going to eventually want to be able to update all the fields but
> for now i am just trying to get one to work or two to work and then go
> from there.  Now the Contact_ID field is my Primary Key Field.  So when i
> goto modify that record it knows which one to pull and save to.
>
> > you have the syntax wrong
>
> it should be
>
> sqlstring = "UPDATE Contact SET Account = " & Request.Form("Account")
> &  " WHERE ContactID = '" & Request.Form("Contact") & "'"
>
>
>
>
>
> -----Original Message-----
> From: Joshua Krause [mailto:jkrause@t...]
> Sent: Tuesday, April 02, 2002 3:51 PM
> To: ASP Databases
> Subject: [asp_databases] RE: Help Updating Database
>
>
> Ok i changed my code to look like this:
> sqlstring = "UPDATE Contact " &  "SET Account = " Request.Form("Account")
> &  "WHERE ContactID = 'Contact_ID" & Request.Form("Contact") & "'"
>
> and i get this error:
> Error Type:
> Microsoft VBScript compilation (0x800A0401)
> Expected end of statement
> /newserver/IP Migration/writeto.asp, line 16, column 50
>
> The fields Account and Contact_ID are numerical fields.
>
> > I assumed you knew that the underscore character was the line
> continuation character, but apparently you didn't.
>
> In my last email, I wrote this:
>
> sqlstring = "UPDATE Contact " & _
>             "SET Account = " Request.Form("Account") & _
>             "WHERE ContactID = 'Contact_ID" & Request.Form("Contact") &
> "'"
>
> The above code is on 3 lines, and the _ character tells the ASP to
> continue the command on the next line.  If you put it all on one line,
> you must remove the underscore.  Your post notes an invalid character at
> column 34 because you have the _ there still, but you moved the
> following line up onto the same line.  Try it again, just as it appears
> above.
>
> Also, you didn't answer the question about what the data types were.  So
> I'm still assuming that Account is numeric and ContactID is a text
> field.
>
> -Pete
>
>
> > -----Original Message-----
> > From: Joshua Krause [mailto:jkrause@t...]
> > Sent: Tuesday, April 02, 2002 12:36 AM
> > To: ASP Databases
> > Subject: [asp_databases] RE: Help Updating Database
> >
> >
> > This is what it looks like with the changes
> > sqlstring = "UPDATE Contact " & _ "SET Account = "
> > Request.Form("Account")
> > & _ "WHERE ContactID = 'Contact_ID" & Request.Form("Contact") & "'"
> >
> > This is the error:
> > Error Type:
> > Microsoft VBScript compilation (0x800A0408)
> > Invalid character
> > /newserver/IP Migration/writeto.asp, line 16, column 34
> >
> > The Name of the Access Database is Contact.
> > The Fields in the Access Database are:
> > Account                 CMTS
> > Customer                GW_IP
> > Street_Address          Start
> > Phone                   NAT_GW_IP
> > Batch                   Port_Fwds
> > Technical_Contact       DHCP
> > Email                   Persistent_DHCP_or_Static_IP
> > Old_IP                  Notes
> > New_IP                  Updated_by
> > MAC_Addy                Date_Updated
> > Node
> >
> > My database is full of Business Customers that may have some
> > fields filled
> > out.  I am trying to make it to where my co workers can goto
> > a html based
> > site and pull up anyone of the customers.  And then be able
> > to click Add
> > or Modify and make changes or additions to the data base.
> > And this is the
> > only page killin me.
> >
> >
> > > Did you get rid of that trailing "Line 16" at the end?
> >
> > Also, what data type is Account?  Also, is the ContactID form a text
> > field in the database?  If so, then your WHERE clause should look like
> > this:
> >
> > WHERE ContactID = 'Contact_ID" & Request.Form("Contact") & "'"
> >
> > If not, then this statement doesn't make any sense, because the
> > "Contact_ID" portion is a string, not a number.  Try something like
> > this:
> >
> > sqlstring = "UPDATE Contact " & _
> >             "SET Account = " Request.Form("Account") & _
> >             "WHERE ContactID = 'Contact_ID" &
> > Request.Form("Contact") &
> > "'"
> >
> >
> > > -----Original Message-----
> > > From: Joshua Krause [mailto:jkrause@t...]
> > > Sent: Monday, April 01, 2002 11:46 PM
> > > To: ASP Databases
> > > Subject: [asp_databases] RE: Help Updating Database
> > >
> > >
> > > Ok so now it looks like this
> > > sqlstring = "UPDATE Contact SET Account = " &
> > > Request.Form("Account") & "
> > > WHERE ContactID = Contact_ID" & Request.Form("Contact")   Line 16
> > >
> > > but now i get this error message
> > > Error Type:
> > > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> > > [Microsoft][ODBC Microsoft Access Driver] Syntax error in
> > > UPDATE statement.
> > > /newserver/IP Migration/writeto.asp, line 17
> > >
> > >
> > > > You forgot to end your string before
> > > Request.Form("Account") and after
> > > it.
> > > " & Request.Form("Account") & "
> > >
> > > -Pete
> > >
> > > > -----Original Message-----
> > > > From: Joshua Krause [mailto:jkrause@t...]
> > > > Sent: Monday, April 01, 2002 11:29 PM
> > > > To: ASP Databases
> > > > Subject: [asp_databases] Help Updating Database
> > > >
> > > >
> > > > I am having an issue updating an Access Database using ASP.
> > > > This is my error message:
> > > > Error Type:
> > > > Microsoft VBScript compilation (0x800A0401)
> > > > Expected end of statement
> > > > /newserver/IP Migration/writeto.asp, line 16, column 56
> > > >
> > > > Here is my code:
> > > >
> > > > <%@ Language="VBScript" %>
> > > > <%
> > > > Set RRConn = Server.CreateObject("ADODB.Connection")
> > > > RRConnstring = "DSN=Contact; UID=; PWD="
> > > > RRConn.Open(RRConnstring)
> > > >
> > > > If Request.Form("Type") = "Delete" Then
> > > > Set rrRst = Server.CreateObject("ADODB.Recordset")
> > > > sqlstring = "DELETE FROM [Contact] WHERE
> > > > [Contact_ID] =" &
> > > > Request.Form("Contact")
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > RRConn.Close
> > > > Response.Write "<center><b>Record was
> > > > deleted</center></b>"
> > > > End If
> > > > If Request.Form("Type") = "Modify" Then
> > > > Set rrRst = Server.CreateObject("ADODB.Recordset")
> > > > sqlstring = "UPDATE Contact SET Account = Request.Form
> > > > ("Account") WHERE ContactID = Contact_ID" &
> > > > Request.Form("Contact") Line 16
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > rrRst.Fields("Account") = Request.Form("Account")
> > > > rrRst.Fields("Customer") = Request.Form("Customer")
> > > > rrRst.Fields("Street_Address") = Request.Form
> > > > ("Street_Address")
> > > > rrRst.Fields("Phone") = Request.Form("Phone")
> > > > rrRst.Fields("Batch") = Request.Form("Batch")
> > > > rrRst.Fields("Technical_Contact") = Request.Form
> > > > ("Technical_Contact")
> > > > rrRst.Fields("Email") = Request.Form("Email")
> > > > rrRst.Fields("Old_IP") = Request.Form("Old_IP")
> > > > rrRst.Fields("New_IP") = Request.Form("New_IP")
> > > > rrRst.Fields("MAC_Addy") = Request.Form("MAC_Addy")
> > > > rrRst.Fields("Node") = Request.Form("Node")
> > > > rrRst.Fields("CMTS") = Request.Form("CMTS")
> > > > rrRst.Fields("GW_IP") = Request.Form("GW_IP")
> > > > rrRst.Fields("Start") = Request.Form("Start")
> > > > rrRst.Fields("NAT_GW_IP") = Request.Form("NAT_GW_IP")
> > > > rrRst.Fields("Port_Fwds") = Request.Form("Port_Fwds")
> > > > rrRst.Fields("DHCP") = Request.Form("DHCP")
> > > > rrRst.Fields("Persistent_DHCP_or_Static_IP") 
> > > > Request.Form
> > > > ("Persistent_DHCP_or_Static_IP")
> > > > rrRst.Fields("Notes") = Request.Form("Notes")
> > > > rrRst.Fields("Updated_by") = Request.Form("Updated_by")
> > > > rrRst.Fields("Date_Updated") 
> > > > Request.Form("Date_Updated")
> > > > rrRst.Update
> > > > rrRst.Close
> > > >    ' Set MyRst = Nothing
> > > > RRConn.Close
> > > > 'Set MyConn = Nothing
> > > > Response.Write "<b><center>Record was
> > > > modified</center></b>"
> > > > End If
> > > > If Request.Form("Type") = "Add" Then
> > > > Set rrRst = Server.CreateObject("ADODB.Recordset")
> > > > sqlstring = "SELECT * FROM [Contact] "
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > rrRst.AddNew
> > > > rrRst.Fields("Account") = Request.Form("Account")
> > > > rrRst.Fields("Customer") = Request.Form("Customer")
> > > > rrRst.Fields("Street_Address") = Request.Form
> > > > ("Street_Address")
> > > > rrRst.Fields("Phone") = Request.Form("Phone")
> > > > rrRst.Fields("Batch") = Request.Form("Batch")
> > > > rrRst.Fields("Technical_Contact") = Request.Form
> > > > ("Technical_Contact")
> > > > rrRst.Fields("Email") = Request.Form("Email")
> > > > rrRst.Fields("Old_IP") = Request.Form("Old_IP")
> > > > rrRst.Fields("New_IP") = Request.Form("New_IP")
> > > > rrRst.Fields("MAC_Addy") = Request.Form("MAC_Addy")
> > > > rrRst.Fields("Node") = Request.Form("Node")
> > > > rrRst.Fields("CMTS") = Request.Form("CMTS")
> > > > rrRst.Fields("GW_IP") = Request.Form("GW_IP")
> > > > rrRst.Fields("Start") = Request.Form("Start")
> > > > rrRst.Fields("NAT_GW_IP") = Request.Form("NAT_GW_IP")
> > > > rrRst.Fields("Port_Fwds") = Request.Form("Port_Fwds")
> > > > rrRst.Fields("DHCP") = Request.Form("DHCP")
> > > > rrRst.Fields("Persistent_DHCP_or_Static_IP") 
> > > > Request.Form
> > > > ("Persistent_DHCP_or_Static_IP")
> > > > rrRst.Fields("Notes") = Request.Form("Notes")
> > > > rrRst.Fields("Updated_by") = Request.Form("Updated_by")
> > > > rrRst.Fields("Date_Updated") 
> > > > Request.Form("Date_Updated")
> > > > rrRst.Update
> > > > rrRst.Close
> > > > 'Set MyRst = Nothing
> > > > RRConn.Close
> > > > 'Set MyConn = Nothing
> > > > Response.Write"<center><b>Record was added</b></center>"
> > > >
> > > > End If
> > > > 'MyConn.Close
> > > > 'Set MyConn = Nothing
> > > > %>
> > > >
> > > >
> > > >
> > > >
> > > > <html>
> > > >
> > > > <head>
> > > > <title>Write to DB</title>
> > > > </head>
> > > >
> > > > <body bgcolor="white">
> > > >
> > > > <p align="center">Please Follow Link back to welcome page </p>
> > > > <p align="center">&nbsp;</p>
> > > > <p align="center"><a href="welcome.asp">Home</a></p>
> > > >
> > > > </body>
> > > >
> > > > </html>
> > > >
> > > > Can someone tell me what i need to do or am doing wrong in
> > > > order to be
> > > > able to update my fields in my database?
> > > >
> > >
> >
>


Message #5 by "Breidenbach, Beth" <Beth.Breidenbach@g...> on Tue, 2 Apr 2002 11:44:57 -0800
You have too many "SET"s.

Valid query is:  UPDATE Contact SET Account =3D '300520-01',  Customer 
=3D 'American Webbing &
Fitting' WHERE Contact_ID =3D 53

-----Original Message-----
From: Joshua Krause [mailto:jkrause@t...]
Sent: Tuesday, April 02, 2002 11:03 AM
To: ASP Databases
Subject: [asp_databases] RE: Help Updating Database


sqlstring =3D "UPDATE Contact SET Account =3D '" & 
Request.Form("Account") & "'
SET Customer =3D '" & Request.Form("Customer") & "' WHERE Contact_ID =3D 
" &
Request.Form("Contact")


I got it to work with the first two which is Account and Contact_ID.  
Now i
am throwing in the Customer field which is a text field.  I ran the
response.write sqlstring and i get this
UPDATE Contact SET Account =3D '300520-01' SET Customer =3D 'American 
Webbing &
Fitting' WHERE Contact_ID =3D 53

And then i go into Access and the database and run a sql query on it and 
i
get this
Syntax error (missing operator) in query expression "300520-01' SET 
Customer
=3D 'American Webbing & Fitting".

Joshua
Tech #10190
High Speed Data Services
Time Warner Cable - Greensboro Division

----- Original Message -----
From: "Breidenbach, Beth" <Beth.Breidenbach@g...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, April 02, 2002 11:28 AM
Subject: [asp_databases] RE: Help Updating Database


Joshua, use a Response.Write to output your fully-built query string to 
the
web page.

Next, use Access's query builder to create the same query and use the 
View,
SQLView option from the Access menu -- it'll show you the SQL generated 
by
Access.

You should then be able to compare and determine the difference between 
the
access-generated query and the query you created.

If you still can't get it to work, send us BOTH queries -- the 
ASP-generated
and the Access-generated.

Beth

-----Original Message-----
From: Joshua Krause [mailto:jkrause@t...]
Sent: Tuesday, April 02, 2002 8:26 AM
To: ASP Databases
Subject: [asp_databases] RE: Help Updating Database


Don't know how to do that?  The data is setup in Access in all the 
different
fields as listed below.  With no quotes whatsoever.  The data is then 
pulled
from the Access Database.  I can get the data to display in my table 
just
fine.  But i have a modify option to where i want to be able to modify
certain fields that might not have any data and need to enter.  Or just 
need
to update data that is currently in the field.  But like i said all my 
other
pages work fine even my delete option is working just not my add and 
modify
options.  Which are all on the writeto.asp page.

Joshua
Tech #10190
High Speed Data Services
Time Warner Cable - Greensboro Division

----- Original Message -----
From: "Meinken, Joe" <Joe.Meinken@q...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, April 02, 2002 10:50 AM
Subject: [asp_databases] RE: Help Updating Database


> How are you sending the data?  With quotes around it?  Without quotes?
How
> is this field set up in the table you're trying to update?  Have you
> attempted to output the sqlstring variable, copied it out of the 
browser
and
> attempted to run it through Acess?
>
> -----Original Message-----
> From: Joshua Krause [mailto:jkrause@t...]
> Sent: Tuesday, April 02, 2002 10:13 AM
> To: ASP Databases
> Subject: [asp_databases] RE: Help Updating Database
>
>
> Okay i did what you sd and added this line:
> sqlstring =3D "UPDATE Contact SET Account =3D " & 
Request.Form("Account") &  "
> WHERE ContactID =3D '" & Request.Form("Contact") & "'"
>
> And this is my error:
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
statement.
> /newserver/IP Migration/writeto.asp, line 17
>
> Now i am going to eventually want to be able to update all the fields 
but
> for now i am just trying to get one to work or two to work and then go
> from there.  Now the Contact_ID field is my Primary Key Field.  So 
when i
> goto modify that record it knows which one to pull and save to.
>
> > you have the syntax wrong
>
> it should be
>
> sqlstring =3D "UPDATE Contact SET Account =3D " & 
Request.Form("Account")
> &  " WHERE ContactID =3D '" & Request.Form("Contact") & "'"
>
>
>
>
>
> -----Original Message-----
> From: Joshua Krause [mailto:jkrause@t...]
> Sent: Tuesday, April 02, 2002 3:51 PM
> To: ASP Databases
> Subject: [asp_databases] RE: Help Updating Database
>
>
> Ok i changed my code to look like this:
> sqlstring =3D "UPDATE Contact " &  "SET Account =3D " 
Request.Form("Account")
> &  "WHERE ContactID =3D 'Contact_ID" & Request.Form("Contact") & "'"
>
> and i get this error:
> Error Type:
> Microsoft VBScript compilation (0x800A0401)
> Expected end of statement
> /newserver/IP Migration/writeto.asp, line 16, column 50
>
> The fields Account and Contact_ID are numerical fields.
>
> > I assumed you knew that the underscore character was the line
> continuation character, but apparently you didn't.
>
> In my last email, I wrote this:
>
> sqlstring =3D "UPDATE Contact " & _
>             "SET Account =3D " Request.Form("Account") & _
>             "WHERE ContactID =3D 'Contact_ID" & 
Request.Form("Contact") &
> "'"
>
> The above code is on 3 lines, and the _ character tells the ASP to
> continue the command on the next line.  If you put it all on one line,
> you must remove the underscore.  Your post notes an invalid character 
at
> column 34 because you have the _ there still, but you moved the
> following line up onto the same line.  Try it again, just as it 
appears
> above.
>
> Also, you didn't answer the question about what the data types were.  
So
> I'm still assuming that Account is numeric and ContactID is a text
> field.
>
> -Pete
>
>
> > -----Original Message-----
> > From: Joshua Krause [mailto:jkrause@t...]
> > Sent: Tuesday, April 02, 2002 12:36 AM
> > To: ASP Databases
> > Subject: [asp_databases] RE: Help Updating Database
> >
> >
> > This is what it looks like with the changes
> > sqlstring =3D "UPDATE Contact " & _ "SET Account =3D "
> > Request.Form("Account")
> > & _ "WHERE ContactID =3D 'Contact_ID" & Request.Form("Contact") & 
"'"
> >
> > This is the error:
> > Error Type:
> > Microsoft VBScript compilation (0x800A0408)
> > Invalid character
> > /newserver/IP Migration/writeto.asp, line 16, column 34
> >
> > The Name of the Access Database is Contact.
> > The Fields in the Access Database are:
> > Account                 CMTS
> > Customer                GW_IP
> > Street_Address          Start
> > Phone                   NAT_GW_IP
> > Batch                   Port_Fwds
> > Technical_Contact       DHCP
> > Email                   Persistent_DHCP_or_Static_IP
> > Old_IP                  Notes
> > New_IP                  Updated_by
> > MAC_Addy                Date_Updated
> > Node
> >
> > My database is full of Business Customers that may have some
> > fields filled
> > out.  I am trying to make it to where my co workers can goto
> > a html based
> > site and pull up anyone of the customers.  And then be able
> > to click Add
> > or Modify and make changes or additions to the data base.
> > And this is the
> > only page killin me.
> >
> >
> > > Did you get rid of that trailing "Line 16" at the end?
> >
> > Also, what data type is Account?  Also, is the ContactID form a text
> > field in the database?  If so, then your WHERE clause should look 
like
> > this:
> >
> > WHERE ContactID =3D 'Contact_ID" & Request.Form("Contact") & "'"
> >
> > If not, then this statement doesn't make any sense, because the
> > "Contact_ID" portion is a string, not a number.  Try something like
> > this:
> >
> > sqlstring =3D "UPDATE Contact " & _
> >             "SET Account =3D " Request.Form("Account") & _
> >             "WHERE ContactID =3D 'Contact_ID" &
> > Request.Form("Contact") &
> > "'"
> >
> >
> > > -----Original Message-----
> > > From: Joshua Krause [mailto:jkrause@t...]
> > > Sent: Monday, April 01, 2002 11:46 PM
> > > To: ASP Databases
> > > Subject: [asp_databases] RE: Help Updating Database
> > >
> > >
> > > Ok so now it looks like this
> > > sqlstring =3D "UPDATE Contact SET Account =3D " &
> > > Request.Form("Account") & "
> > > WHERE ContactID =3D Contact_ID" & Request.Form("Contact")   Line 
16
> > >
> > > but now i get this error message
> > > Error Type:
> > > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> > > [Microsoft][ODBC Microsoft Access Driver] Syntax error in
> > > UPDATE statement.
> > > /newserver/IP Migration/writeto.asp, line 17
> > >
> > >
> > > > You forgot to end your string before
> > > Request.Form("Account") and after
> > > it.
> > > " & Request.Form("Account") & "
> > >
> > > -Pete
> > >
> > > > -----Original Message-----
> > > > From: Joshua Krause [mailto:jkrause@t...]
> > > > Sent: Monday, April 01, 2002 11:29 PM
> > > > To: ASP Databases
> > > > Subject: [asp_databases] Help Updating Database
> > > >
> > > >
> > > > I am having an issue updating an Access Database using ASP.
> > > > This is my error message:
> > > > Error Type:
> > > > Microsoft VBScript compilation (0x800A0401)
> > > > Expected end of statement
> > > > /newserver/IP Migration/writeto.asp, line 16, column 56
> > > >
> > > > Here is my code:
> > > >
> > > > <%@ Language=3D"VBScript" %>
> > > > <%
> > > > Set RRConn =3D Server.CreateObject("ADODB.Connection")
> > > > RRConnstring =3D "DSN=3DContact; UID=3D; PWD=3D"
> > > > RRConn.Open(RRConnstring)
> > > >
> > > > If Request.Form("Type") =3D "Delete" Then
> > > > Set rrRst =3D Server.CreateObject("ADODB.Recordset")
> > > > sqlstring =3D "DELETE FROM [Contact] WHERE
> > > > [Contact_ID] =3D" &
> > > > Request.Form("Contact")
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > RRConn.Close
> > > > Response.Write "<center><b>Record was
> > > > deleted</center></b>"
> > > > End If
> > > > If Request.Form("Type") =3D "Modify" Then
> > > > Set rrRst =3D Server.CreateObject("ADODB.Recordset")
> > > > sqlstring =3D "UPDATE Contact SET Account =3D Request.Form
> > > > ("Account") WHERE ContactID =3D Contact_ID" &
> > > > Request.Form("Contact") Line 16
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > rrRst.Fields("Account") =3D Request.Form("Account")
> > > > rrRst.Fields("Customer") =3D Request.Form("Customer")
> > > > rrRst.Fields("Street_Address") =3D Request.Form
> > > > ("Street_Address")
> > > > rrRst.Fields("Phone") =3D Request.Form("Phone")
> > > > rrRst.Fields("Batch") =3D Request.Form("Batch")
> > > > rrRst.Fields("Technical_Contact") =3D Request.Form
> > > > ("Technical_Contact")
> > > > rrRst.Fields("Email") =3D Request.Form("Email")
> > > > rrRst.Fields("Old_IP") =3D Request.Form("Old_IP")
> > > > rrRst.Fields("New_IP") =3D Request.Form("New_IP")
> > > > rrRst.Fields("MAC_Addy") =3D Request.Form("MAC_Addy")
> > > > rrRst.Fields("Node") =3D Request.Form("Node")
> > > > rrRst.Fields("CMTS") =3D Request.Form("CMTS")
> > > > rrRst.Fields("GW_IP") =3D Request.Form("GW_IP")
> > > > rrRst.Fields("Start") =3D Request.Form("Start")
> > > > rrRst.Fields("NAT_GW_IP") =3D Request.Form("NAT_GW_IP")
> > > > rrRst.Fields("Port_Fwds") =3D Request.Form("Port_Fwds")
> > > > rrRst.Fields("DHCP") =3D Request.Form("DHCP")
> > > > rrRst.Fields("Persistent_DHCP_or_Static_IP") =3D
> > > > Request.Form
> > > > ("Persistent_DHCP_or_Static_IP")
> > > > rrRst.Fields("Notes") =3D Request.Form("Notes")
> > > > rrRst.Fields("Updated_by") =3D Request.Form("Updated_by")
> > > > rrRst.Fields("Date_Updated") =3D
> > > > Request.Form("Date_Updated")
> > > > rrRst.Update
> > > > rrRst.Close
> > > >    ' Set MyRst =3D Nothing
> > > > RRConn.Close
> > > > 'Set MyConn =3D Nothing
> > > > Response.Write "<b><center>Record was
> > > > modified</center></b>"
> > > > End If
> > > > If Request.Form("Type") =3D "Add" Then
> > > > Set rrRst =3D Server.CreateObject("ADODB.Recordset")
> > > > sqlstring =3D "SELECT * FROM [Contact] "
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > rrRst.AddNew
> > > > rrRst.Fields("Account") =3D Request.Form("Account")
> > > > rrRst.Fields("Customer") =3D Request.Form("Customer")
> > > > rrRst.Fields("Street_Address") =3D Request.Form
> > > > ("Street_Address")
> > > > rrRst.Fields("Phone") =3D Request.Form("Phone")
> > > > rrRst.Fields("Batch") =3D Request.Form("Batch")
> > > > rrRst.Fields("Technical_Contact") =3D Request.Form
> > > > ("Technical_Contact")
> > > > rrRst.Fields("Email") =3D Request.Form("Email")
> > > > rrRst.Fields("Old_IP") =3D Request.Form("Old_IP")
> > > > rrRst.Fields("New_IP") =3D Request.Form("New_IP")
> > > > rrRst.Fields("MAC_Addy") =3D Request.Form("MAC_Addy")
> > > > rrRst.Fields("Node") =3D Request.Form("Node")
> > > > rrRst.Fields("CMTS") =3D Request.Form("CMTS")
> > > > rrRst.Fields("GW_IP") =3D Request.Form("GW_IP")
> > > > rrRst.Fields("Start") =3D Request.Form("Start")
> > > > rrRst.Fields("NAT_GW_IP") =3D Request.Form("NAT_GW_IP")
> > > > rrRst.Fields("Port_Fwds") =3D Request.Form("Port_Fwds")
> > > > rrRst.Fields("DHCP") =3D Request.Form("DHCP")
> > > > rrRst.Fields("Persistent_DHCP_or_Static_IP") =3D
> > > > Request.Form
> > > > ("Persistent_DHCP_or_Static_IP")
> > > > rrRst.Fields("Notes") =3D Request.Form("Notes")
> > > > rrRst.Fields("Updated_by") =3D Request.Form("Updated_by")
> > > > rrRst.Fields("Date_Updated") =3D
> > > > Request.Form("Date_Updated")
> > > > rrRst.Update
> > > > rrRst.Close
> > > > 'Set MyRst =3D Nothing
> > > > RRConn.Close
> > > > 'Set MyConn =3D Nothing
> > > > Response.Write"<center><b>Record was added</b></center>"
> > > >
> > > > End If
> > > > 'MyConn.Close
> > > > 'Set MyConn =3D Nothing
> > > > %>
> > > >
> > > >
> > > >
> > > >
> > > > <html>
> > > >
> > > > <head>
> > > > <title>Write to DB</title>
> > > > </head>
> > > >
> > > > <body bgcolor=3D"white">
> > > >
> > > > <p align=3D"center">Please Follow Link back to welcome page </p>
> > > > <p align=3D"center">&nbsp;</p>
> > > > <p align=3D"center"><a href=3D"welcome.asp">Home</a></p>
> > > >
> > > > </body>
> > > >
> > > > </html>
> > > >
> > > > Can someone tell me what i need to do or am doing wrong in
> > > > order to be
> > > > able to update my fields in my database?
> > > >
> > >
> >
>





Message #6 by "Kim Iwan Hansen" <kimiwan@k...> on Tue, 2 Apr 2002 21:26:16 +0200
the correct formula is:

UPDATE table SET fieldname = newvalue, fieldname2 = newvalue2

:o)

-Kim

-----Original Message-----
From: Joshua Krause [mailto:jkrause@t...]
Sent: 2. april 2002 21:03
To: ASP Databases
Subject: [asp_databases] RE: Help Updating Database


sqlstring = "UPDATE Contact SET Account = '" & Request.Form("Account") & "'
SET Customer = '" & Request.Form("Customer") & "' WHERE Contact_ID = " &
Request.Form("Contact")


I got it to work with the first two which is Account and Contact_ID.  Now i
am throwing in the Customer field which is a text field.  I ran the
response.write sqlstring and i get this
UPDATE Contact SET Account = '300520-01' SET Customer = 'American Webbing &
Fitting' WHERE Contact_ID = 53

And then i go into Access and the database and run a sql query on it and i
get this
Syntax error (missing operator) in query expression "300520-01' SET Customer
= 'American Webbing & Fitting".

Joshua
Tech #10190
High Speed Data Services
Time Warner Cable - Greensboro Division

----- Original Message -----
From: "Breidenbach, Beth" <Beth.Breidenbach@g...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, April 02, 2002 11:28 AM
Subject: [asp_databases] RE: Help Updating Database


Joshua, use a Response.Write to output your fully-built query string to the
web page.

Next, use Access's query builder to create the same query and use the View,
SQLView option from the Access menu -- it'll show you the SQL generated by
Access.

You should then be able to compare and determine the difference between the
access-generated query and the query you created.

If you still can't get it to work, send us BOTH queries -- the ASP-generated
and the Access-generated.

Beth

-----Original Message-----
From: Joshua Krause [mailto:jkrause@t...]
Sent: Tuesday, April 02, 2002 8:26 AM
To: ASP Databases
Subject: [asp_databases] RE: Help Updating Database


Don't know how to do that?  The data is setup in Access in all the different
fields as listed below.  With no quotes whatsoever.  The data is then pulled
from the Access Database.  I can get the data to display in my table just
fine.  But i have a modify option to where i want to be able to modify
certain fields that might not have any data and need to enter.  Or just need
to update data that is currently in the field.  But like i said all my other
pages work fine even my delete option is working just not my add and modify
options.  Which are all on the writeto.asp page.

Joshua
Tech #10190
High Speed Data Services
Time Warner Cable - Greensboro Division

----- Original Message -----
From: "Meinken, Joe" <Joe.Meinken@q...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, April 02, 2002 10:50 AM
Subject: [asp_databases] RE: Help Updating Database


> How are you sending the data?  With quotes around it?  Without quotes?
How
> is this field set up in the table you're trying to update?  Have you
> attempted to output the sqlstring variable, copied it out of the browser
and
> attempted to run it through Acess?
>
> -----Original Message-----
> From: Joshua Krause [mailto:jkrause@t...]
> Sent: Tuesday, April 02, 2002 10:13 AM
> To: ASP Databases
> Subject: [asp_databases] RE: Help Updating Database
>
>
> Okay i did what you sd and added this line:
> sqlstring = "UPDATE Contact SET Account = " & Request.Form("Account") &  "
> WHERE ContactID = '" & Request.Form("Contact") & "'"
>
> And this is my error:
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
statement.
> /newserver/IP Migration/writeto.asp, line 17
>
> Now i am going to eventually want to be able to update all the fields but
> for now i am just trying to get one to work or two to work and then go
> from there.  Now the Contact_ID field is my Primary Key Field.  So when i
> goto modify that record it knows which one to pull and save to.
>
> > you have the syntax wrong
>
> it should be
>
> sqlstring = "UPDATE Contact SET Account = " & Request.Form("Account")
> &  " WHERE ContactID = '" & Request.Form("Contact") & "'"
>
>
>
>
>
> -----Original Message-----
> From: Joshua Krause [mailto:jkrause@t...]
> Sent: Tuesday, April 02, 2002 3:51 PM
> To: ASP Databases
> Subject: [asp_databases] RE: Help Updating Database
>
>
> Ok i changed my code to look like this:
> sqlstring = "UPDATE Contact " &  "SET Account = " Request.Form("Account")
> &  "WHERE ContactID = 'Contact_ID" & Request.Form("Contact") & "'"
>
> and i get this error:
> Error Type:
> Microsoft VBScript compilation (0x800A0401)
> Expected end of statement
> /newserver/IP Migration/writeto.asp, line 16, column 50
>
> The fields Account and Contact_ID are numerical fields.
>
> > I assumed you knew that the underscore character was the line
> continuation character, but apparently you didn't.
>
> In my last email, I wrote this:
>
> sqlstring = "UPDATE Contact " & _
>             "SET Account = " Request.Form("Account") & _
>             "WHERE ContactID = 'Contact_ID" & Request.Form("Contact") &
> "'"
>
> The above code is on 3 lines, and the _ character tells the ASP to
> continue the command on the next line.  If you put it all on one line,
> you must remove the underscore.  Your post notes an invalid character at
> column 34 because you have the _ there still, but you moved the
> following line up onto the same line.  Try it again, just as it appears
> above.
>
> Also, you didn't answer the question about what the data types were.  So
> I'm still assuming that Account is numeric and ContactID is a text
> field.
>
> -Pete
>
>
> > -----Original Message-----
> > From: Joshua Krause [mailto:jkrause@t...]
> > Sent: Tuesday, April 02, 2002 12:36 AM
> > To: ASP Databases
> > Subject: [asp_databases] RE: Help Updating Database
> >
> >
> > This is what it looks like with the changes
> > sqlstring = "UPDATE Contact " & _ "SET Account = "
> > Request.Form("Account")
> > & _ "WHERE ContactID = 'Contact_ID" & Request.Form("Contact") & "'"
> >
> > This is the error:
> > Error Type:
> > Microsoft VBScript compilation (0x800A0408)
> > Invalid character
> > /newserver/IP Migration/writeto.asp, line 16, column 34
> >
> > The Name of the Access Database is Contact.
> > The Fields in the Access Database are:
> > Account                 CMTS
> > Customer                GW_IP
> > Street_Address          Start
> > Phone                   NAT_GW_IP
> > Batch                   Port_Fwds
> > Technical_Contact       DHCP
> > Email                   Persistent_DHCP_or_Static_IP
> > Old_IP                  Notes
> > New_IP                  Updated_by
> > MAC_Addy                Date_Updated
> > Node
> >
> > My database is full of Business Customers that may have some
> > fields filled
> > out.  I am trying to make it to where my co workers can goto
> > a html based
> > site and pull up anyone of the customers.  And then be able
> > to click Add
> > or Modify and make changes or additions to the data base.
> > And this is the
> > only page killin me.
> >
> >
> > > Did you get rid of that trailing "Line 16" at the end?
> >
> > Also, what data type is Account?  Also, is the ContactID form a text
> > field in the database?  If so, then your WHERE clause should look like
> > this:
> >
> > WHERE ContactID = 'Contact_ID" & Request.Form("Contact") & "'"
> >
> > If not, then this statement doesn't make any sense, because the
> > "Contact_ID" portion is a string, not a number.  Try something like
> > this:
> >
> > sqlstring = "UPDATE Contact " & _
> >             "SET Account = " Request.Form("Account") & _
> >             "WHERE ContactID = 'Contact_ID" &
> > Request.Form("Contact") &
> > "'"
> >
> >
> > > -----Original Message-----
> > > From: Joshua Krause [mailto:jkrause@t...]
> > > Sent: Monday, April 01, 2002 11:46 PM
> > > To: ASP Databases
> > > Subject: [asp_databases] RE: Help Updating Database
> > >
> > >
> > > Ok so now it looks like this
> > > sqlstring = "UPDATE Contact SET Account = " &
> > > Request.Form("Account") & "
> > > WHERE ContactID = Contact_ID" & Request.Form("Contact")   Line 16
> > >
> > > but now i get this error message
> > > Error Type:
> > > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> > > [Microsoft][ODBC Microsoft Access Driver] Syntax error in
> > > UPDATE statement.
> > > /newserver/IP Migration/writeto.asp, line 17
> > >
> > >
> > > > You forgot to end your string before
> > > Request.Form("Account") and after
> > > it.
> > > " & Request.Form("Account") & "
> > >
> > > -Pete
> > >
> > > > -----Original Message-----
> > > > From: Joshua Krause [mailto:jkrause@t...]
> > > > Sent: Monday, April 01, 2002 11:29 PM
> > > > To: ASP Databases
> > > > Subject: [asp_databases] Help Updating Database
> > > >
> > > >
> > > > I am having an issue updating an Access Database using ASP.
> > > > This is my error message:
> > > > Error Type:
> > > > Microsoft VBScript compilation (0x800A0401)
> > > > Expected end of statement
> > > > /newserver/IP Migration/writeto.asp, line 16, column 56
> > > >
> > > > Here is my code:
> > > >
> > > > <%@ Language="VBScript" %>
> > > > <%
> > > > Set RRConn = Server.CreateObject("ADODB.Connection")
> > > > RRConnstring = "DSN=Contact; UID=; PWD="
> > > > RRConn.Open(RRConnstring)
> > > >
> > > > If Request.Form("Type") = "Delete" Then
> > > > Set rrRst = Server.CreateObject("ADODB.Recordset")
> > > > sqlstring = "DELETE FROM [Contact] WHERE
> > > > [Contact_ID] =" &
> > > > Request.Form("Contact")
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > RRConn.Close
> > > > Response.Write "<center><b>Record was
> > > > deleted</center></b>"
> > > > End If
> > > > If Request.Form("Type") = "Modify" Then
> > > > Set rrRst = Server.CreateObject("ADODB.Recordset")
> > > > sqlstring = "UPDATE Contact SET Account = Request.Form
> > > > ("Account") WHERE ContactID = Contact_ID" &
> > > > Request.Form("Contact") Line 16
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > rrRst.Fields("Account") = Request.Form("Account")
> > > > rrRst.Fields("Customer") = Request.Form("Customer")
> > > > rrRst.Fields("Street_Address") = Request.Form
> > > > ("Street_Address")
> > > > rrRst.Fields("Phone") = Request.Form("Phone")
> > > > rrRst.Fields("Batch") = Request.Form("Batch")
> > > > rrRst.Fields("Technical_Contact") = Request.Form
> > > > ("Technical_Contact")
> > > > rrRst.Fields("Email") = Request.Form("Email")
> > > > rrRst.Fields("Old_IP") = Request.Form("Old_IP")
> > > > rrRst.Fields("New_IP") = Request.Form("New_IP")
> > > > rrRst.Fields("MAC_Addy") = Request.Form("MAC_Addy")
> > > > rrRst.Fields("Node") = Request.Form("Node")
> > > > rrRst.Fields("CMTS") = Request.Form("CMTS")
> > > > rrRst.Fields("GW_IP") = Request.Form("GW_IP")
> > > > rrRst.Fields("Start") = Request.Form("Start")
> > > > rrRst.Fields("NAT_GW_IP") = Request.Form("NAT_GW_IP")
> > > > rrRst.Fields("Port_Fwds") = Request.Form("Port_Fwds")
> > > > rrRst.Fields("DHCP") = Request.Form("DHCP")
> > > > rrRst.Fields("Persistent_DHCP_or_Static_IP") 
> > > > Request.Form
> > > > ("Persistent_DHCP_or_Static_IP")
> > > > rrRst.Fields("Notes") = Request.Form("Notes")
> > > > rrRst.Fields("Updated_by") = Request.Form("Updated_by")
> > > > rrRst.Fields("Date_Updated") 
> > > > Request.Form("Date_Updated")
> > > > rrRst.Update
> > > > rrRst.Close
> > > >    ' Set MyRst = Nothing
> > > > RRConn.Close
> > > > 'Set MyConn = Nothing
> > > > Response.Write "<b><center>Record was
> > > > modified</center></b>"
> > > > End If
> > > > If Request.Form("Type") = "Add" Then
> > > > Set rrRst = Server.CreateObject("ADODB.Recordset")
> > > > sqlstring = "SELECT * FROM [Contact] "
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > rrRst.AddNew
> > > > rrRst.Fields("Account") = Request.Form("Account")
> > > > rrRst.Fields("Customer") = Request.Form("Customer")
> > > > rrRst.Fields("Street_Address") = Request.Form
> > > > ("Street_Address")
> > > > rrRst.Fields("Phone") = Request.Form("Phone")
> > > > rrRst.Fields("Batch") = Request.Form("Batch")
> > > > rrRst.Fields("Technical_Contact") = Request.Form
> > > > ("Technical_Contact")
> > > > rrRst.Fields("Email") = Request.Form("Email")
> > > > rrRst.Fields("Old_IP") = Request.Form("Old_IP")
> > > > rrRst.Fields("New_IP") = Request.Form("New_IP")
> > > > rrRst.Fields("MAC_Addy") = Request.Form("MAC_Addy")
> > > > rrRst.Fields("Node") = Request.Form("Node")
> > > > rrRst.Fields("CMTS") = Request.Form("CMTS")
> > > > rrRst.Fields("GW_IP") = Request.Form("GW_IP")
> > > > rrRst.Fields("Start") = Request.Form("Start")
> > > > rrRst.Fields("NAT_GW_IP") = Request.Form("NAT_GW_IP")
> > > > rrRst.Fields("Port_Fwds") = Request.Form("Port_Fwds")
> > > > rrRst.Fields("DHCP") = Request.Form("DHCP")
> > > > rrRst.Fields("Persistent_DHCP_or_Static_IP") 
> > > > Request.Form
> > > > ("Persistent_DHCP_or_Static_IP")
> > > > rrRst.Fields("Notes") = Request.Form("Notes")
> > > > rrRst.Fields("Updated_by") = Request.Form("Updated_by")
> > > > rrRst.Fields("Date_Updated") 
> > > > Request.Form("Date_Updated")
> > > > rrRst.Update
> > > > rrRst.Close
> > > > 'Set MyRst = Nothing
> > > > RRConn.Close
> > > > 'Set MyConn = Nothing
> > > > Response.Write"<center><b>Record was added</b></center>"
> > > >
> > > > End If
> > > > 'MyConn.Close
> > > > 'Set MyConn = Nothing
> > > > %>
> > > >
> > > >
> > > >
> > > >
> > > > <html>
> > > >
> > > > <head>
> > > > <title>Write to DB</title>
> > > > </head>
> > > >
> > > > <body bgcolor="white">
> > > >
> > > > <p align="center">Please Follow Link back to welcome page </p>
> > > > <p align="center">&nbsp;</p>
> > > > <p align="center"><a href="welcome.asp">Home</a></p>
> > > >
> > > > </body>
> > > >
> > > > </html>
> > > >
> > > > Can someone tell me what i need to do or am doing wrong in
> > > > order to be
> > > > able to update my fields in my database?
> > > >
> > >
> >
>






Message #7 by "Joshua Krause" <jkrause@t...> on Tue, 2 Apr 2002 14:02:37 -0500
sqlstring = "UPDATE Contact SET Account = '" & Request.Form("Account") & "'
SET Customer = '" & Request.Form("Customer") & "' WHERE Contact_ID = " &
Request.Form("Contact")


I got it to work with the first two which is Account and Contact_ID.  Now i
am throwing in the Customer field which is a text field.  I ran the
response.write sqlstring and i get this
UPDATE Contact SET Account = '300520-01' SET Customer = 'American Webbing &
Fitting' WHERE Contact_ID = 53

And then i go into Access and the database and run a sql query on it and i
get this
Syntax error (missing operator) in query expression "300520-01' SET Customer
= 'American Webbing & Fitting".

Joshua
Tech #10190
High Speed Data Services
Time Warner Cable - Greensboro Division

----- Original Message -----
From: "Breidenbach, Beth" <Beth.Breidenbach@g...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, April 02, 2002 11:28 AM
Subject: [asp_databases] RE: Help Updating Database


Joshua, use a Response.Write to output your fully-built query string to the
web page.

Next, use Access's query builder to create the same query and use the View,
SQLView option from the Access menu -- it'll show you the SQL generated by
Access.

You should then be able to compare and determine the difference between the
access-generated query and the query you created.

If you still can't get it to work, send us BOTH queries -- the ASP-generated
and the Access-generated.

Beth

-----Original Message-----
From: Joshua Krause [mailto:jkrause@t...]
Sent: Tuesday, April 02, 2002 8:26 AM
To: ASP Databases
Subject: [asp_databases] RE: Help Updating Database


Don't know how to do that?  The data is setup in Access in all the different
fields as listed below.  With no quotes whatsoever.  The data is then pulled
from the Access Database.  I can get the data to display in my table just
fine.  But i have a modify option to where i want to be able to modify
certain fields that might not have any data and need to enter.  Or just need
to update data that is currently in the field.  But like i said all my other
pages work fine even my delete option is working just not my add and modify
options.  Which are all on the writeto.asp page.

Joshua
Tech #10190
High Speed Data Services
Time Warner Cable - Greensboro Division

----- Original Message -----
From: "Meinken, Joe" <Joe.Meinken@q...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, April 02, 2002 10:50 AM
Subject: [asp_databases] RE: Help Updating Database


> How are you sending the data?  With quotes around it?  Without quotes?
How
> is this field set up in the table you're trying to update?  Have you
> attempted to output the sqlstring variable, copied it out of the browser
and
> attempted to run it through Acess?
>
> -----Original Message-----
> From: Joshua Krause [mailto:jkrause@t...]
> Sent: Tuesday, April 02, 2002 10:13 AM
> To: ASP Databases
> Subject: [asp_databases] RE: Help Updating Database
>
>
> Okay i did what you sd and added this line:
> sqlstring = "UPDATE Contact SET Account = " & Request.Form("Account") &  "
> WHERE ContactID = '" & Request.Form("Contact") & "'"
>
> And this is my error:
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE
statement.
> /newserver/IP Migration/writeto.asp, line 17
>
> Now i am going to eventually want to be able to update all the fields but
> for now i am just trying to get one to work or two to work and then go
> from there.  Now the Contact_ID field is my Primary Key Field.  So when i
> goto modify that record it knows which one to pull and save to.
>
> > you have the syntax wrong
>
> it should be
>
> sqlstring = "UPDATE Contact SET Account = " & Request.Form("Account")
> &  " WHERE ContactID = '" & Request.Form("Contact") & "'"
>
>
>
>
>
> -----Original Message-----
> From: Joshua Krause [mailto:jkrause@t...]
> Sent: Tuesday, April 02, 2002 3:51 PM
> To: ASP Databases
> Subject: [asp_databases] RE: Help Updating Database
>
>
> Ok i changed my code to look like this:
> sqlstring = "UPDATE Contact " &  "SET Account = " Request.Form("Account")
> &  "WHERE ContactID = 'Contact_ID" & Request.Form("Contact") & "'"
>
> and i get this error:
> Error Type:
> Microsoft VBScript compilation (0x800A0401)
> Expected end of statement
> /newserver/IP Migration/writeto.asp, line 16, column 50
>
> The fields Account and Contact_ID are numerical fields.
>
> > I assumed you knew that the underscore character was the line
> continuation character, but apparently you didn't.
>
> In my last email, I wrote this:
>
> sqlstring = "UPDATE Contact " & _
>             "SET Account = " Request.Form("Account") & _
>             "WHERE ContactID = 'Contact_ID" & Request.Form("Contact") &
> "'"
>
> The above code is on 3 lines, and the _ character tells the ASP to
> continue the command on the next line.  If you put it all on one line,
> you must remove the underscore.  Your post notes an invalid character at
> column 34 because you have the _ there still, but you moved the
> following line up onto the same line.  Try it again, just as it appears
> above.
>
> Also, you didn't answer the question about what the data types were.  So
> I'm still assuming that Account is numeric and ContactID is a text
> field.
>
> -Pete
>
>
> > -----Original Message-----
> > From: Joshua Krause [mailto:jkrause@t...]
> > Sent: Tuesday, April 02, 2002 12:36 AM
> > To: ASP Databases
> > Subject: [asp_databases] RE: Help Updating Database
> >
> >
> > This is what it looks like with the changes
> > sqlstring = "UPDATE Contact " & _ "SET Account = "
> > Request.Form("Account")
> > & _ "WHERE ContactID = 'Contact_ID" & Request.Form("Contact") & "'"
> >
> > This is the error:
> > Error Type:
> > Microsoft VBScript compilation (0x800A0408)
> > Invalid character
> > /newserver/IP Migration/writeto.asp, line 16, column 34
> >
> > The Name of the Access Database is Contact.
> > The Fields in the Access Database are:
> > Account                 CMTS
> > Customer                GW_IP
> > Street_Address          Start
> > Phone                   NAT_GW_IP
> > Batch                   Port_Fwds
> > Technical_Contact       DHCP
> > Email                   Persistent_DHCP_or_Static_IP
> > Old_IP                  Notes
> > New_IP                  Updated_by
> > MAC_Addy                Date_Updated
> > Node
> >
> > My database is full of Business Customers that may have some
> > fields filled
> > out.  I am trying to make it to where my co workers can goto
> > a html based
> > site and pull up anyone of the customers.  And then be able
> > to click Add
> > or Modify and make changes or additions to the data base.
> > And this is the
> > only page killin me.
> >
> >
> > > Did you get rid of that trailing "Line 16" at the end?
> >
> > Also, what data type is Account?  Also, is the ContactID form a text
> > field in the database?  If so, then your WHERE clause should look like
> > this:
> >
> > WHERE ContactID = 'Contact_ID" & Request.Form("Contact") & "'"
> >
> > If not, then this statement doesn't make any sense, because the
> > "Contact_ID" portion is a string, not a number.  Try something like
> > this:
> >
> > sqlstring = "UPDATE Contact " & _
> >             "SET Account = " Request.Form("Account") & _
> >             "WHERE ContactID = 'Contact_ID" &
> > Request.Form("Contact") &
> > "'"
> >
> >
> > > -----Original Message-----
> > > From: Joshua Krause [mailto:jkrause@t...]
> > > Sent: Monday, April 01, 2002 11:46 PM
> > > To: ASP Databases
> > > Subject: [asp_databases] RE: Help Updating Database
> > >
> > >
> > > Ok so now it looks like this
> > > sqlstring = "UPDATE Contact SET Account = " &
> > > Request.Form("Account") & "
> > > WHERE ContactID = Contact_ID" & Request.Form("Contact")   Line 16
> > >
> > > but now i get this error message
> > > Error Type:
> > > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> > > [Microsoft][ODBC Microsoft Access Driver] Syntax error in
> > > UPDATE statement.
> > > /newserver/IP Migration/writeto.asp, line 17
> > >
> > >
> > > > You forgot to end your string before
> > > Request.Form("Account") and after
> > > it.
> > > " & Request.Form("Account") & "
> > >
> > > -Pete
> > >
> > > > -----Original Message-----
> > > > From: Joshua Krause [mailto:jkrause@t...]
> > > > Sent: Monday, April 01, 2002 11:29 PM
> > > > To: ASP Databases
> > > > Subject: [asp_databases] Help Updating Database
> > > >
> > > >
> > > > I am having an issue updating an Access Database using ASP.
> > > > This is my error message:
> > > > Error Type:
> > > > Microsoft VBScript compilation (0x800A0401)
> > > > Expected end of statement
> > > > /newserver/IP Migration/writeto.asp, line 16, column 56
> > > >
> > > > Here is my code:
> > > >
> > > > <%@ Language="VBScript" %>
> > > > <%
> > > > Set RRConn = Server.CreateObject("ADODB.Connection")
> > > > RRConnstring = "DSN=Contact; UID=; PWD="
> > > > RRConn.Open(RRConnstring)
> > > >
> > > > If Request.Form("Type") = "Delete" Then
> > > > Set rrRst = Server.CreateObject("ADODB.Recordset")
> > > > sqlstring = "DELETE FROM [Contact] WHERE
> > > > [Contact_ID] =" &
> > > > Request.Form("Contact")
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > RRConn.Close
> > > > Response.Write "<center><b>Record was
> > > > deleted</center></b>"
> > > > End If
> > > > If Request.Form("Type") = "Modify" Then
> > > > Set rrRst = Server.CreateObject("ADODB.Recordset")
> > > > sqlstring = "UPDATE Contact SET Account = Request.Form
> > > > ("Account") WHERE ContactID = Contact_ID" &
> > > > Request.Form("Contact") Line 16
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > rrRst.Fields("Account") = Request.Form("Account")
> > > > rrRst.Fields("Customer") = Request.Form("Customer")
> > > > rrRst.Fields("Street_Address") = Request.Form
> > > > ("Street_Address")
> > > > rrRst.Fields("Phone") = Request.Form("Phone")
> > > > rrRst.Fields("Batch") = Request.Form("Batch")
> > > > rrRst.Fields("Technical_Contact") = Request.Form
> > > > ("Technical_Contact")
> > > > rrRst.Fields("Email") = Request.Form("Email")
> > > > rrRst.Fields("Old_IP") = Request.Form("Old_IP")
> > > > rrRst.Fields("New_IP") = Request.Form("New_IP")
> > > > rrRst.Fields("MAC_Addy") = Request.Form("MAC_Addy")
> > > > rrRst.Fields("Node") = Request.Form("Node")
> > > > rrRst.Fields("CMTS") = Request.Form("CMTS")
> > > > rrRst.Fields("GW_IP") = Request.Form("GW_IP")
> > > > rrRst.Fields("Start") = Request.Form("Start")
> > > > rrRst.Fields("NAT_GW_IP") = Request.Form("NAT_GW_IP")
> > > > rrRst.Fields("Port_Fwds") = Request.Form("Port_Fwds")
> > > > rrRst.Fields("DHCP") = Request.Form("DHCP")
> > > > rrRst.Fields("Persistent_DHCP_or_Static_IP") 
> > > > Request.Form
> > > > ("Persistent_DHCP_or_Static_IP")
> > > > rrRst.Fields("Notes") = Request.Form("Notes")
> > > > rrRst.Fields("Updated_by") = Request.Form("Updated_by")
> > > > rrRst.Fields("Date_Updated") 
> > > > Request.Form("Date_Updated")
> > > > rrRst.Update
> > > > rrRst.Close
> > > >    ' Set MyRst = Nothing
> > > > RRConn.Close
> > > > 'Set MyConn = Nothing
> > > > Response.Write "<b><center>Record was
> > > > modified</center></b>"
> > > > End If
> > > > If Request.Form("Type") = "Add" Then
> > > > Set rrRst = Server.CreateObject("ADODB.Recordset")
> > > > sqlstring = "SELECT * FROM [Contact] "
> > > > rrRst.Open sqlstring, RRConn, 3, 3
> > > > rrRst.AddNew
> > > > rrRst.Fields("Account") = Request.Form("Account")
> > > > rrRst.Fields("Customer") = Request.Form("Customer")
> > > > rrRst.Fields("Street_Address") = Request.Form
> > > > ("Street_Address")
> > > > rrRst.Fields("Phone") = Request.Form("Phone")
> > > > rrRst.Fields("Batch") = Request.Form("Batch")
> > > > rrRst.Fields("Technical_Contact") = Request.Form
> > > > ("Technical_Contact")
> > > > rrRst.Fields("Email") = Request.Form("Email")
> > > > rrRst.Fields("Old_IP") = Request.Form("Old_IP")
> > > > rrRst.Fields("New_IP") = Request.Form("New_IP")
> > > > rrRst.Fields("MAC_Addy") = Request.Form("MAC_Addy")
> > > > rrRst.Fields("Node") = Request.Form("Node")
> > > > rrRst.Fields("CMTS") = Request.Form("CMTS")
> > > > rrRst.Fields("GW_IP") = Request.Form("GW_IP")
> > > > rrRst.Fields("Start") = Request.Form("Start")
> > > > rrRst.Fields("NAT_GW_IP") = Request.Form("NAT_GW_IP")
> > > > rrRst.Fields("Port_Fwds") = Request.Form("Port_Fwds")
> > > > rrRst.Fields("DHCP") = Request.Form("DHCP")
> > > > rrRst.Fields("Persistent_DHCP_or_Static_IP") 
> > > > Request.Form
> > > > ("Persistent_DHCP_or_Static_IP")
> > > > rrRst.Fields("Notes") = Request.Form("Notes")
> > > > rrRst.Fields("Updated_by") = Request.Form("Updated_by")
> > > > rrRst.Fields("Date_Updated") 
> > > > Request.Form("Date_Updated")
> > > > rrRst.Update
> > > > rrRst.Close
> > > > 'Set MyRst = Nothing
> > > > RRConn.Close
> > > > 'Set MyConn = Nothing
> > > > Response.Write"<center><b>Record was added</b></center>"
> > > >
> > > > End If
> > > > 'MyConn.Close
> > > > 'Set MyConn = Nothing
> > > > %>
> > > >
> > > >
> > > >
> > > >
> > > > <html>
> > > >
> > > > <head>
> > > > <title>Write to DB</title>
> > > > </head>
> > > >
> > > > <body bgcolor="white">
> > > >
> > > > <p align="center">Please Follow Link back to welcome page </p>
> > > > <p align="center">&nbsp;</p>
> > > > <p align="center"><a href="welcome.asp">Home</a></p>
> > > >
> > > > </body>
> > > >
> > > > </html>
> > > >
> > > > Can someone tell me what i need to do or am doing wrong in
> > > > order to be
> > > > able to update my fields in my database?
> > > >
> > >
> >
>




Message #8 by "Drew, Ron" <RDrew@B...> on Tue, 2 Apr 2002 12:25:39 -0500
Sorry for the misunderstanding...it is one or the other...since you
indicated both are numeric...
sqlstring =3D "UPDATE Contact " & _
 "SET Account =3D " Request.Form("Account") &_              
 " WHERE ContactID =3D " & Request.Form("Contact")& ";"   


-----Original Message-----
From: Joshua Krause [mailto:jkrause@t...]
Sent: Tuesday, April 02, 2002 11:28 AM
To: ASP Databases
Subject: [asp_databases] RE: Help Updating Database


i added the lines:
sqlstring =3D "UPDATE Contact " & _
 "SET Account =3D " Request.Form("Account") &_               'if Account
numeric
 "SET Account =3D '" Request.Form("Account") & "'" &_        'if Account
is alpha
 " WHERE ContactID =3D " & Request.Form("Contact")& ";"      'if 
ContactID
is numeric
 " WHERE ContactID =3D '" & Request.Form("Contact") & "';"   'if 
ContactID
is alpha

and here is the error i get:
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/newserver/IP Migration/writeto.asp, line 16, column 12


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Page:
POST 220 bytes to /newserver/IP Migration/writeto.asp

POST Data:
Contact=3D3&Type=3DModify&T1=3D&T2=3DAllen+Percision&T3=3D&T4=3D&T5=3D1&T
6=3D&T7=3D&T8=3D24.
88.
223.208%2F30&T9=3D24.199.226.12%
2F30&T10=3D0002.FDD8.7807&T11=3D&T12=3D&T13=3D13&T14=3D14&T15=3D192.168.1
.1&T18=3DN&T1
7=3DY
&T16=3D255.255.255.252 . . .

Time:
Tuesday, April 02, 2002, 10:12:48 AM

> Add a space before the WHERE like below and see other comments...I
assume Account is numeric and ContactID is numeric

-----Original Message-----
From: Joshua Krause [mailto:jkrause@t...]=3D20
Sent: Monday, April 01, 2002 7:36 PM
To: ASP Databases
Subject: [asp_databases] RE: Help Updating Database



sqlstring =3D3D "UPDATE Contact " & _=3D20
            "SET Account =3D3D " Request.Form("Account") & _
'if Account numeric
            "SET Account =3D3D '" Request.Form("Account") & "'" & _ 'if
Account is alpha
            " WHERE ContactID =3D3D " & Request.Form("Contact") & ";" 
'if
ContactID is numeric
            " WHERE ContactID =3D3D '" & Request.Form("Contact") & "';"
'if ContactID is alpha


This is the error:
Error Type:
Microsoft VBScript compilation (0x800A0408)
Invalid character
/newserver/IP Migration/writeto.asp, line 16, column 34

The Name of the Access Database is Contact.
The Fields in the Access Database are:
Account                 CMTS
Customer                GW_IP  =3D20
Street_Address          Start
Phone                   NAT_GW_IP
Batch                   Port_Fwds
Technical_Contact       DHCP=3D20
Email                   Persistent_DHCP_or_Static_IP
Old_IP                  Notes
New_IP                  Updated_by
MAC_Addy                Date_Updated=3D20
Node=3D20

My database is full of Business Customers that may have some fields
filled=3D20 out.  I am trying to make it to where my co workers can goto 
a
html based=3D20 site and pull up anyone of the customers.  And then be
able to click Add

or Modify and make changes or additions to the data base.  And this is
the=3D20 only page killin me.


> Did you get rid of that trailing "Line 16" at the end?

Also, what data type is Account?  Also, is the ContactID form a text
field in the database?  If so, then your WHERE clause should look like
this:

WHERE ContactID =3D3D 'Contact_ID" & Request.Form("Contact") & "'"

If not, then this statement doesn't make any sense, because the
"Contact_ID" portion is a string, not a number.  Try something like
this:

sqlstring =3D3D "UPDATE Contact " & _
            "SET Account =3D3D " Request.Form("Account") & _
            "WHERE ContactID =3D3D 'Contact_ID" & 
Request.Form("Contact")
=3D & "'"


> -----Original Message-----
> From: Joshua Krause [mailto:jkrause@t...]
> Sent: Monday, April 01, 2002 11:46 PM
> To: ASP Databases
> Subject: [asp_databases] RE: Help Updating Database
>=3D20
>=3D20
> Ok so now it looks like this
> sqlstring =3D3D "UPDATE Contact SET Account =3D3D " &=3D20
> Request.Form("Account") & "=3D20
> WHERE ContactID =3D3D Contact_ID" & Request.Form("Contact")   Line 16
>=3D20
> but now i get this error message
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)=3D20 
>[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE=3D20 
>statement. /newserver/IP Migration/writeto.asp, line 17 =3D20
>=3D20
> > You forgot to end your string before
> Request.Form("Account") and after
> it.
> " & Request.Form("Account") & "
>=3D20
> -Pete
>=3D20
> > -----Original Message-----
> > From: Joshua Krause [mailto:jkrause@t...]
> > Sent: Monday, April 01, 2002 11:29 PM
> > To: ASP Databases
> > Subject: [asp_databases] Help Updating Database
> >=3D20
> >=3D20
> > I am having an issue updating an Access Database using ASP. This
> >is=3D20  my error message: Error Type:  Microsoft VBScript 
compilation
> >(0x800A0401)  Expected end of statement
> > /newserver/IP Migration/writeto.asp, line 16, column 56
> >=3D20
> > Here is my code:
> >=3D20
> > <%@ Language=3D3D"VBScript" %>
> > <%
> > 	Set RRConn =3D3D Server.CreateObject("ADODB.Connection")
> > 	RRConnstring =3D3D "DSN=3D3DContact; UID=3D3D; PWD=3D3D"
> > 	RRConn.Open(RRConnstring)
> >=3D20
> > 	If Request.Form("Type") =3D3D "Delete" Then
> > 		Set rrRst =3D3D Server.CreateObject("ADODB.Recordset")
> > 		sqlstring =3D3D "DELETE FROM [Contact] WHERE
> > [Contact_ID] =3D3D" &=3D20
> > Request.Form("Contact")
> > 		rrRst.Open sqlstring, RRConn, 3, 3
> > 		RRConn.Close
> > 		Response.Write "<center><b>Record was=3D20
> > deleted</center></b>"
> > 	End If
> > 	If Request.Form("Type") =3D3D "Modify" Then
> > 		Set rrRst =3D3D Server.CreateObject("ADODB.Recordset")
> > 		sqlstring =3D3D "UPDATE Contact SET Account =3D3D
Request.Form
> > ("Account") WHERE ContactID =3D3D Contact_ID" &=3D20
> > Request.Form("Contact") Line 16
> > 		rrRst.Open sqlstring, RRConn, 3, 3
> > 		rrRst.Fields("Account") =3D3D Request.Form("Account")
> > 		rrRst.Fields("Customer") =3D3D Request.Form("Customer")
> > 		rrRst.Fields("Street_Address") =3D3D Request.Form
> > ("Street_Address")
> > 		rrRst.Fields("Phone") =3D3D Request.Form("Phone")
> > 		rrRst.Fields("Batch") =3D3D Request.Form("Batch")
> > 		rrRst.Fields("Technical_Contact") =3D3D Request.Form
> > ("Technical_Contact")
> > 		rrRst.Fields("Email") =3D3D Request.Form("Email")
> > 		rrRst.Fields("Old_IP") =3D3D Request.Form("Old_IP")
> > 		rrRst.Fields("New_IP") =3D3D Request.Form("New_IP")
> > 		rrRst.Fields("MAC_Addy") =3D3D Request.Form("MAC_Addy")
> > 		rrRst.Fields("Node") =3D3D Request.Form("Node")
> > 		rrRst.Fields("CMTS") =3D3D Request.Form("CMTS")
> > 		rrRst.Fields("GW_IP") =3D3D Request.Form("GW_IP")
> > 		rrRst.Fields("Start") =3D3D Request.Form("Start")
> > 		rrRst.Fields("NAT_GW_IP") =3D3D Request.Form("NAT_GW_IP")
> > 		rrRst.Fields("Port_Fwds") =3D3D Request.Form("Port_Fwds")
> > 		rrRst.Fields("DHCP") =3D3D Request.Form("DHCP")
> > 		rrRst.Fields("Persistent_DHCP_or_Static_IP") =3D3D=3D20
> > Request.Form
> > ("Persistent_DHCP_or_Static_IP")
> > 		rrRst.Fields("Notes") =3D3D Request.Form("Notes")
> > 		rrRst.Fields("Updated_by") =3D3D
Request.Form("Updated_by")
> > 		rrRst.Fields("Date_Updated") =3D3D=3D20
> > Request.Form("Date_Updated")
> > 		rrRst.Update
> > 		rrRst.Close
> > 	   ' Set MyRst =3D3D Nothing
> > 		RRConn.Close
> > 		'Set MyConn =3D3D Nothing
> > 		Response.Write "<b><center>Record was=3D20
> > modified</center></b>"
> > 	End If
> > 	If Request.Form("Type") =3D3D "Add" Then
> > 		Set rrRst =3D3D Server.CreateObject("ADODB.Recordset")
> > 		sqlstring =3D3D "SELECT * FROM [Contact] "
> > 		rrRst.Open sqlstring, RRConn, 3, 3
> > 		rrRst.AddNew
> > 		rrRst.Fields("Account") =3D3D Request.Form("Account")
> > 		rrRst.Fields("Customer") =3D3D Request.Form("Customer")
> > 		rrRst.Fields("Street_Address") =3D3D Request.Form
> > ("Street_Address")
> > 		rrRst.Fields("Phone") =3D3D Request.Form("Phone")
> > 		rrRst.Fields("Batch") =3D3D Request.Form("Batch")
> > 		rrRst.Fields("Technical_Contact") =3D3D Request.Form
> > ("Technical_Contact")
> > 		rrRst.Fields("Email") =3D3D Request.Form("Email")
> > 		rrRst.Fields("Old_IP") =3D3D Request.Form("Old_IP")
> > 		rrRst.Fields("New_IP") =3D3D Request.Form("New_IP")
> > 		rrRst.Fields("MAC_Addy") =3D3D Request.Form("MAC_Addy")
> > 		rrRst.Fields("Node") =3D3D Request.Form("Node")
> > 		rrRst.Fields("CMTS") =3D3D Request.Form("CMTS")
> > 		rrRst.Fields("GW_IP") =3D3D Request.Form("GW_IP")
> > 		rrRst.Fields("Start") =3D3D Request.Form("Start")
> > 		rrRst.Fields("NAT_GW_IP") =3D3D Request.Form("NAT_GW_IP")
> > 		rrRst.Fields("Port_Fwds") =3D3D Request.Form("Port_Fwds")
> > 		rrRst.Fields("DHCP") =3D3D Request.Form("DHCP")
> > 		rrRst.Fields("Persistent_DHCP_or_Static_IP") =3D3D=3D20
> > Request.Form
> > ("Persistent_DHCP_or_Static_IP")
> > 		rrRst.Fields("Notes") =3D3D Request.Form("Notes")
> > 		rrRst.Fields("Updated_by") =3D3D
Request.Form("Updated_by")
> > 		rrRst.Fields("Date_Updated") =3D3D=3D20
> > Request.Form("Date_Updated")
> > 		rrRst.Update
> > 		rrRst.Close
> > 		'Set MyRst =3D3D Nothing
> > 		RRConn.Close
> > 		'Set MyConn =3D3D Nothing
> > 		Response.Write"<center><b>Record was added</b></center>"
> > 	=3D09
> > 	End If
> > 	'MyConn.Close
> > 	'Set MyConn =3D3D Nothing
> > 	%>
> > 	=3D09
> >=3D20
> > =3D09
> >=3D20
> > <html>
> >=3D20
> > <head>
> > <title>Write to DB</title>
> > </head>
> >=3D20
> > <body bgcolor=3D3D"white">
> >=3D20
> > <p align=3D3D"center">Please Follow Link back to welcome page </p>
<p=3D20
> > align=3D3D"center">&nbsp;</p> <p align=3D3D"center"><a=3D20
> > href=3D3D"welcome.asp">Home</a></p>
> >=3D20
> > </body>
> >=3D20
> > </html>
> >=3D20
> > Can someone tell me what