Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - major headache with SQL in ASP
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

major headache with SQL in ASP

 Post Reply Post Reply
Author
ainsworth14 View Drop Down
Groupie
Groupie


Joined: 05 August 2003
Location: United Kingdom
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote ainsworth14 Quote  Post ReplyReply Direct Link To This Post Topic: major headache with SQL in ASP
    Posted: 04 August 2004 at 5:18pm

I am trying to run through an asp book i have but also trying to customize the lessons in there to my own personal needs.

i have created a database input form on addproduct.asp which then send info to manageproduct.asp for this page to process and add a record to my database.

when i try to add product i always get his annoying message saying:

  • Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
    /manageproducts.asp, line 50

    POST Data:
    id=12234&artist=artist&title=title&description=d esc&year=1224&label=label&format=12inch&catn umber=catnum&price=5.00&audio=audio&image=image& amp; amp;stock=3&addProduct=1

 

but i cannot see anything wrong with the code here:

<%
'add new product
IF addProduct <> "" THEN

sqlString = "INSERT INTO record_webtest (ID, Artist, Title, Descrip, YR, Label, Format, Cat, Price GBP, Audio, Image, Stock) "&_
"VALUES ( " & id & "," &_
"'" & artist & "'," &_
"'" & title & "'," &_
"'" & descrip & "'," &_
yr & "," &_
"'" & label & "'," &_
"'" & format & "'," &_
"'" & catnumber & "'," &_
price & "," &_
"'" & audio & "'," &_
"'" & image & "'," &_
stock & ")"


Con.Execute sqlString **(LINE 50)**

%>

 

I have used response.write to get an output of the sql and it is absolutely fine:

INSERT INTO record_webtest (ID, Artist, Title, Descrip, YR, Label, Format, Cat, Price GBP, Audio, Image, Stock) VALUES ( 12234,'artist','title','desc',1224,'label','12inch','catnum' ,5.00,'audio','image',3)

can anyone advise me?

 

many thanks

mark



Edited by ainsworth14
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 04 August 2004 at 6:00pm

There is a space between Price and BBP
 ...Cat, Price GBP, Audio, Image,...

if you change that the code is fine, if there in fact is a space in the table name (bad idea) enclose it in [] so [Price GBP] if not, take it out.

Back to Top
ainsworth14 View Drop Down
Groupie
Groupie


Joined: 05 August 2003
Location: United Kingdom
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote ainsworth14 Quote  Post ReplyReply Direct Link To This Post Posted: 05 August 2004 at 1:52pm

YES!!

thanks very much, solved it, working fine now!

im new to ASP so overlooked that bit

mark

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.