Hi i'm trying to connect to MySQL Database using ODBC Connection Driver. There was no error message when i executed it, but my database doesn't seem to be updated. Any form of help will be greatly appreciated! Below is my code
Dim MyDB : MyDB=Server.CreateObject("ADODB.Connection")
MyDB.open "Driver={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=mydatabase; USER=root; PASSWORD=*****; OPTION=3;"
MyDB.Execute("INSERT INTO carriertest VALUES('3', 'temp');")
Thank you very much
Database Connection
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
The value returned by the Execute function should give you some clues.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Erm how do you check what value is actually taken in? How do we print out the value? Sorry I'm a total newbie
After changing the final line to
Set rs = MyDB.Execute("INSERT INTO carriertest VALUES('3', 'temp');")
I now get an error message
Specified Window "rs = MyDB.Execute("INSERT INTO carriertest VALUES('3', 'temp');")" Not Present, Any subsequent key sends in script may cause exceptions.
Thanks for your help
After changing the final line to
Set rs = MyDB.Execute("INSERT INTO carriertest VALUES('3', 'temp');")
I now get an error message
Specified Window "rs = MyDB.Execute("INSERT INTO carriertest VALUES('3', 'temp');")" Not Present, Any subsequent key sends in script may cause exceptions.
Thanks for your help
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
The code you provided is VBScript. So it should appear in a VBScript block. Something like:
VBSTART
Dim MyDB
Dim rs
Set MyDB = Server.CreateObject("ADODB.Connection")
MyDB.open "Driver={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=mydatabase; USER=root; PASSWORD=*****; OPTION=3;"
Set rs = MyDB.Execute("INSERT INTO carriertest VALUES('3', 'temp');")
VBEND
VBSTART
Dim MyDB
Dim rs
Set MyDB = Server.CreateObject("ADODB.Connection")
MyDB.open "Driver={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=mydatabase; USER=root; PASSWORD=*****; OPTION=3;"
Set rs = MyDB.Execute("INSERT INTO carriertest VALUES('3', 'temp');")
VBEND
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?