Visual Basic Help
Posted: Thu Mar 11, 2010 4:15 pm
Hello, I'm trying to add some code to an existing program.
I am using Visual studio 2008 and I need to write some code to write some data to a mysql database.
I can get this working in excel and have been doing this for some time, I cannot however get it working in Visual Studio.
The code I'm using is ...
I have the mysql 5.1 odbc driver installed and as I said running this code through excel runs without any problems, however using this code in VS does not.
What am I doing wrong / missing ?
Thanks
I am using Visual studio 2008 and I need to write some code to write some data to a mysql database.
I can get this working in excel and have been doing this for some time, I cannot however get it working in Visual Studio.
The code I'm using is ...
Code: Select all
Dim conn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
conn.Open "UID=root;PWD=password;DATABASE=db;SERVER=localhost;DRIVER=MYSQL ODBC 5.1 DRIVER"
Set cmd.ActiveConnection = conn
rs.CursorLocation = adUseClient
cmd.CommandText = "INSERT INTO blah (blah2) VALUES (blah3)"
cmd.Execute
What am I doing wrong / missing ?
Thanks