Go Back   nV News Forums > Software Forums > Software Development

Newegg Daily Deals

Reply
 
Thread Tools
Old 12-03-07, 06:00 AM   #1
technoid
Registered User
 
Join Date: Jul 2004
Location: Denton, Texas
Posts: 505
Default Learning MySQL using ASP

I'm trying to learn MySQL using ASP and I'm getting a syntax error when I try to add a row to an empty table I created, does anyone know what's wrong with the last line of the code I'm using? Or anything else for that matter. It seems to connect to MySQL but I get the error message below. The name of the table in MySQL is 'order' so that part should be okay, I think, at least I looked and it shows the name 'order'. The 'id' element is auto incrementing and I've tried leaving it out of the update list too. Thanks for any help.

CODE
Quote:
connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr

Set oRS = oConn.Execute ( "INSERT INTO order (id, type, pn, cc) VALUES (NULL, 'SDP3430', '910', '5486')" )
ERROR
Quote:
[MySQL][ODBC 3.51 Driver][mysqld-4.1.22-max-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (id, type, pn, cc) VALUES (NULL, 'SDP3430', '910', '5486')' at line 1
__________________
Antec-SOLO | ASUS-P5Q-SE | C2D-E8600 | AC-Freezer-7-Pro | Seasonic-S12-550W | 3GB-KVR-PC2-6400 | GTX-560Ti | SB-XtremeGamer | Pioneer-BDR-205 | Samsung-S223B | Dell-U2412M
technoid is offline   Reply With Quote
Old 12-03-07, 11:13 AM   #2
LinuxManMike
<duct tape>C</duct tape>
 
Join Date: Nov 2007
Location: Ohio
Posts: 73
Default Re: Learning MySQL using ASP

order is an SQL keyword. If you are going to use it as a table name try surrounding it with these goofy quote marks (not sure what its called, on same key as tilde ~) like this:
Code:
INSERT INTO `order` (id, type, pn, cc) VALUES (NULL, 'SDP3430', '910', '5486')
LinuxManMike is offline   Reply With Quote
Old 12-03-07, 11:45 AM   #3
technoid
Registered User
 
Join Date: Jul 2004
Location: Denton, Texas
Posts: 505
Default Re: Learning MySQL using ASP

Quote:
Originally Posted by LinuxManMike
order is an SQL keyword. If you are going to use it as a table name try surrounding it with these goofy quote marks (not sure what its called, on same key as tilde ~) like this:
Code:
INSERT INTO `order` (id, type, pn, cc) VALUES (NULL, 'SDP3430', '910', '5486')
Give this man a cookie I fought with this all day yesterday.

I deleted the table and created a new one using sdp_orders as the name and now I can add rows from the on-line manager. I'll go modify my asp code and see if that works too. I'll let you know after I do that, thanks again.

EDIT:
I modified my asp code and it works now too, many thanks. I came so close to using sdp_orders for the table name but I had already created it and didn't know how to change the name so I left it alone. Man, what a mistake Thanks again for your help.
__________________
Antec-SOLO | ASUS-P5Q-SE | C2D-E8600 | AC-Freezer-7-Pro | Seasonic-S12-550W | 3GB-KVR-PC2-6400 | GTX-560Ti | SB-XtremeGamer | Pioneer-BDR-205 | Samsung-S223B | Dell-U2412M
technoid is offline   Reply With Quote
Old 12-03-07, 12:42 PM   #4
LinuxManMike
<duct tape>C</duct tape>
 
Join Date: Nov 2007
Location: Ohio
Posts: 73
Default Re: Learning MySQL using ASP

Glad to help. So... when can I expect that cookie?
LinuxManMike is offline   Reply With Quote
Old 12-03-07, 02:56 PM   #5
technoid
Registered User
 
Join Date: Jul 2004
Location: Denton, Texas
Posts: 505
Default Re: Learning MySQL using ASP

Quote:
Originally Posted by LinuxManMike
Glad to help. So... when can I expect that cookie?
It's in your browser cache
__________________
Antec-SOLO | ASUS-P5Q-SE | C2D-E8600 | AC-Freezer-7-Pro | Seasonic-S12-550W | 3GB-KVR-PC2-6400 | GTX-560Ti | SB-XtremeGamer | Pioneer-BDR-205 | Samsung-S223B | Dell-U2412M
technoid is offline   Reply With Quote
Old 12-03-07, 03:18 PM   #6
LinuxManMike
<duct tape>C</duct tape>
 
Join Date: Nov 2007
Location: Ohio
Posts: 73
Default Re: Learning MySQL using ASP

I must be a geek because I find that hilarious!
LinuxManMike is offline   Reply With Quote
Old 12-04-07, 05:31 AM   #7
technoid
Registered User
 
Join Date: Jul 2004
Location: Denton, Texas
Posts: 505
Default Re: Learning MySQL using ASP

Quote:
Originally Posted by LinuxManMike
I must be a geek because I find that hilarious!
hehehe... I know, it sounds like we're both geeks

I created a demo for my boss and he already has plans for it. So you helped me get another job at work
__________________
Antec-SOLO | ASUS-P5Q-SE | C2D-E8600 | AC-Freezer-7-Pro | Seasonic-S12-550W | 3GB-KVR-PC2-6400 | GTX-560Ti | SB-XtremeGamer | Pioneer-BDR-205 | Samsung-S223B | Dell-U2412M
technoid is offline   Reply With Quote
Old 12-04-07, 09:39 AM   #8
LinuxManMike
<duct tape>C</duct tape>
 
Join Date: Nov 2007
Location: Ohio
Posts: 73
Default Re: Learning MySQL using ASP

Oh, cool, you got a job...

...in that case...

...where's my money???
LinuxManMike is offline   Reply With Quote

Old 12-04-07, 06:47 PM   #9
technoid
Registered User
 
Join Date: Jul 2004
Location: Denton, Texas
Posts: 505
Default Re: Learning MySQL using ASP

Quote:
Originally Posted by LinuxManMike
Oh, cool, you got a job...

...in that case...

...where's my money???
Oh man... I'm dying here I swear, the checks in the mail
__________________
Antec-SOLO | ASUS-P5Q-SE | C2D-E8600 | AC-Freezer-7-Pro | Seasonic-S12-550W | 3GB-KVR-PC2-6400 | GTX-560Ti | SB-XtremeGamer | Pioneer-BDR-205 | Samsung-S223B | Dell-U2412M
technoid is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL 5.5.25 News Archived News Items 0 06-15-12 06:00 AM
Overclocking Core i7-3770K: Learning To Live With Compromise News Archived News Items 0 05-24-12 02:50 AM
nvidia: Interested in learning more about Dynamic Parallelism in CUDA, read our white News Archived News Items 0 05-16-12 09:00 PM
MySQL 5.5.24 News Archived News Items 0 05-09-12 06:10 AM

All times are GMT -5. The time now is 03:22 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.