MyODBC 3.51, MySQL 4.1, vbscript ... type mismatch on closing recordset
The following code is an example of the problem I am experiencing with alot of code that was previously working. The code is being migrated from a MySQL 3.23/MyODBC 3.51.06.00 on the old server to MySQL 4.1/MyODBC is 3.51.11.00 on the new server.
When ever a variable is referenced that was assigned from a recordset field after the recordset is closed a type mismatch error is generated:
Dim db : db = Server.CreateObject("ADODB.Connection")
db.open "DRIVER=MySQL 3.51;DATABASE=blah;UID=blah;PWD=blah"
Dim rs : rs = db.execute("SELECT count(*) FROM some_table")
Dim rows
if not rs.EOF then
rows = rs(0)
else
rows = 0
end if
rs.close
set rs = nothing
if rows > 0 then ' Type Mismatch <<<< The error occurs here
If I wrap rs(0) in a CLng() call the code then works correctly:
Dim db : db = Server.CreateObject("ADODB.Connection")
db.open "DRIVER=MySQL 3.51;DATABASE=blah;UID=blah;PWD=blah"
Dim rs : rs = db.execute("SELECT count(*) FROM some_table")
Dim rows
if not rs.EOF then
rows = CLng(rs(0))
else
rows = 0
end if
rs.close
set rs = nothing
if rows > 0 then ' This now works as expected
My question is, is there a way to set the behaviour of the MySQL/ODBC on the new server to work in a backward compatable way?
Subject
Written By
Posted
MyODBC 3.51, MySQL 4.1, vbscript ... type mismatch on closing recordset
May 10, 2005 08:13AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.