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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATE to a selected record via ASP 1

Status
Not open for further replies.

flock

Instructor
Dec 28, 2004
3
GB
hi all very new to sql I sending this SQL:

UPDATE product SET Product ID, Product Name, Color, Size, M/F, Price (SRP), Product Type ID, Product Class, Supplier ID) SET Product ID = '1107', Product Name = 'Active Outdoors Lycra Glove', Color = '', Size = 'xsm', M/F = '', Price (SRP) = '16.5', Product Type ID = '5', Product Class = 'Accessory', Supplier ID = '1' WHERE (((Product.Product ID)=1107));

using the asp:
cn.Execute(sqlUPDATE) 'sqlUPDATE is equl to the above statement

have a got the syntax wrong I get this error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
/ line 61

any suggestion would be great, thanks
 
Try this:
UPDATE product SET [Product Name] = 'Active Outdoors Lycra Glove', Color = '', Size = 'xsm', [M/F] = '', [Price (SRP)] = '16.5', [Product Type ID] = '5', [Product Class] = 'Accessory', [Supplier ID] = '1' WHERE [Product ID]=1107

For each field defined as numeric, get rid of the single quotes for the corresponding value.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Great thanks, I have changed my sql to include []'s

And written an if statement to take out any blank fields

Works but, have a little issues with changing a field that contains a value to be empty DB has a moan.

But I'm going to look into my DB design.

Just the say thanks, good timing... :)
 
You may play with Null instead of '':
..., [M/F] = Null, ...


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
That'll do it.. thanks again

Is always forget which codes can mean empty but in different way, ego: empty, null, "", blank.

v impressed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top