If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Syntax Error?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-17-03, 12:03
svickrey svickrey is offline
Registered User
 
Join Date: Nov 2003
Location: Fort Stockton, Texas
Posts: 3
Question Syntax Error?

Using this Query:
SELECT * FROM Thomas1 ORDER BY RecordId DESC LIMIT 1;

I Get this Error:
MySQL][ODBC 3.51 Driver][mysqld-3.23.58-nt]You have an error in your SQL syntax near 'SELECT * FROM Thomas1 ORDER BY RecordId DESC LIMIT 1' at line 1

Can you see the error?
This query works from Navicat
But not when I Use it in ASP.
Reply With Quote
  #2 (permalink)  
Old 11-17-03, 14:29
vanekl vanekl is offline
Registered User
 
Join Date: Nov 2003
Posts: 91
This is my guess:

'LIMIT 1' is not standard SQL (it is a MySQL extension)
and ODBC might be choking on this.
Some ODBC drivers have 'passthrough' capabilities
that don't try to parse the SQL statement, and thus
would allow this non-standard SQL statement to pass
through directly to the MySQL server.
I don't know whether the MySQL ODBC drivers have
this capability or not since I don't use it, but if you
want to test this theory just delete the 'LIMIT 1' from
your query.

-lv
Reply With Quote
  #3 (permalink)  
Old 11-17-03, 20:48
svickrey svickrey is offline
Registered User
 
Join Date: Nov 2003
Location: Fort Stockton, Texas
Posts: 3
Update info

Thanks for responding.
I tried what you said and here's what I got:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 3.51 Driver][mysqld-3.23.58-nt]You have an error in your SQL syntax near 'SELECT * FROM Thomas1 ORDER BY RecordId DESC' at line 1

and check this out:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 3.51 Driver][mysqld-3.23.58-nt]You have an error in your SQL syntax near 'SELECT * FROM Thomas1' at line 1

How is this? (The apostrophies are not sent in by me.)
I'm lost.
Reply With Quote
  #4 (permalink)  
Old 11-17-03, 21:34
vanekl vanekl is offline
Registered User
 
Join Date: Nov 2003
Posts: 91
There is nothing wrong with your syntax
(SELECT * FROM Thomas1).
The syntax error message is a red herring. Ignore it -- you
probably have something more seriously wrong.

I'm thinking you have an incompatibility btn the
versions of software you are using, or something's
not installed right. Version 3.51 is supposed to be stable,
as well as MySQL 3.23.58, so those pgms are probably OK.

You may want to create a trace log to see
where the ODBC driver is failing. There is a MySQL
ODBC faq that explains this at:
http://www.mysql.com/products/myodbc/faq_1.html#SEC12

Go back to 'ODBC Data Source Administer' and make sure
the driver and data source is listed in either the 'User DSN'
tab or the 'System DSN' tab.

One other thing you can try: sometimes SQL
statements require a semicolon on the end, and
sometimes not. Try it both ways and see what happens.
In other words, try
SELECT * FROM Thomas1;

Sorry I can't be of any more help.

-lv
Reply With Quote
  #5 (permalink)  
Old 11-18-03, 00:02
svickrey svickrey is offline
Registered User
 
Join Date: Nov 2003
Location: Fort Stockton, Texas
Posts: 3
Smile Thanks again

I have contacted my server admin.
One other thing I forgot to mention.
ADO cannot resolve the recordcount of returned recordsets.
I open a recordset that contains 22 records, I can iterrate through them, but recordcount always equates to -1.
I'm sure this is related as I have never had this problem either.
Thank you for your help.
I'm sure your post will help them identify the problem.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On