Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with syntax error

Status
Not open for further replies.

humbletechie

IS-IT--Management
May 3, 2001
33
US
Hi,

I have a page that reads from a database and populates a form with the results. This form then posts to another page which updates the info. I am receiving a syntax error on the update page. The key is an order # which sometimes gives multiple item results per order #. I would like to post the form with all items, have it loop through each item and update all of them for that order. Can someone please view my code below and give a little advice?

**Update Page**
<%

CompanyCode = cstr(Request.Form(&quot;CompanyCode&quot;))
OrderNumber = cstr(Request.Form(&quot;OrderNumber&quot;))
ItemRoot = UCase(Request.Form(&quot;ItemRoot&quot;))
ColorCode = UCase(Request.Form(&quot;ColorCode&quot;))
SizeCode = cstr(Request.Form(&quot;SizeCode&quot;))
QtyOrdered = cstr(Request.Form(&quot;QtyOrdered&quot;))
DetailSequence = cstr(Request.Form(&quot;DetailSequence&quot;))

set conn=Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open &quot;XXXXXX&quot;,&quot;XXXXXXXX&quot;,&quot;XXXXXXXX&quot;
rs=conn.Execute(&quot;UPDATE OrderDetails SET ItemRoot= '&quot; & ItemRoot & &quot;', ColorCode= '&quot; & ColorCode & &quot;', SizeCode= '&quot; & SizeCode & &quot;', QtyOrdered= '&quot; & QtyOrdered & &quot;' WHERE CompanyCode='&quot; & CompanyCode & &quot;' AND OrderNumber='&quot; & OrderNumber & &quot;' AND DetailSequence ='&quot; & DetailSequence & &quot;'&quot;)
do while not (rs.BOF or rs.EOF)
rs.MoveNext
loop
rs.Close

%>


***Below is the error I am receiving****
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value '1, 2, 3, 4, 5, 6' to a column of data type int.

It seems like it's treating the '1,2,3,4,5,6' as one item sequence rather then seperate sequences.

Any advice would be GREATLY appreciated.

Thanks.
 
Try doing a response.write of the Update statement to see exactly what you are giving the connection. Ladyhawk. [idea]
** ASP/VB/Java Programmer **
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top