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

MYSQL VB.Net OLEDB Connection Problem

Status
Not open for further replies.

vbnetuser1

Technical User
Feb 23, 2011
1
US
I am writing a simple app to connect to a MySql database. When I run the following code:
Dim cnADONetConnection As New OleDb.OleDbConnection
cnADONetConnection.ConnectionString = "DRIVER{MYSQL ODBC 3.51 DRIVER}; SERVER=localhost; DATABASE=test_db_connect; USER=*****; PASSWORD=*****; OPTION=3"

cnADONetConnection.Close()

I get the following error:
---------------------------
Error Message
---------------------------
An error has occured.

ERROR [42000] [MySQL][ODBC 3.51 Driver][mysqld-5.5.9]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 'group' at line 1
---------------------------
OK
---------------------------
No idea what's going on here. The 'group' refered to in the error message is my test table called 'group'. Its 1 table with 2 records. I get the same error if I set the connection to DSN. Any assistance would be appreciated.
Ted
 
Group is a reserved word in MYSQL, as in the "GROUP BY" clause in queries.

If you are going to use it in queries as a table name it must be surrounded by backticks, otherwise it causes errors.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Just as a side issue for future posters and searchers of this thread.
You don't appear to have a connection problem (so whay name the thread as such?). It is with your SQL so please post that!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top