I've written an ASP application in VBScript that uses ADO to connect to, read from and update a MySQL database. The read (select) type queries work fine but any attempt to update a table fails with a variety of fairly generic error messages.
eg.
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Invalid string or buffer length
The application works fine when pointed to an Access database (including updates) but fails with MySQL.
I have all the latest drivers and software on my PC (running Windows NT) and have just installed the version 3.23.36 of MySQL (running on a Unix machine). I've also tried older versions of MySQL - 3.22 and 3.21
An example piece of code follows -
sSQL = "SELECT * FROM UserLogon WHERE ..."
set m_Conn = server.CreateObject("adodb.connection"
m_Conn.Open DB_DSN
' open recordset and find user's logon details
set rs = server.CreateObject("adodb.recordset"
rs.CursorLocation = adUseServer
rs.Open sSQL, m_Conn, adOpenKeyset, adLockOptimistic
if rs.EOF then ' user name not found
sAttemptLogin = "User name or password invalid"
elseif bCheckExpired(rs("Expires"
) then
sAttemptLogin = "Your account has expired. Please contact... "
elseif rs("Frozen"
then
sAttemptLogin = "Your account has been frozen. Please contact..."
elseif rs("Password"
<> trim(Request.Form("Password"
) then
sAttemptLogin = "User name or password invalid"
rs("Attempts"
= rs("Attempts"
+ 1
if rs("Attempts"
>= 5 then
sAttemptLogin = "Too many failed attempts - account frozen. Contact..."
rs("Frozen"
= 1
end if
rs.Update
else ' Login successful
rs("Attempts"
= 0
Session("LastOn"
= rs("LastOn"
rs("LastOn"
= Now
rs.Update
sAttemptLogin = "OK"
end if
' clean up recordset and close database connection
rs.Close
set rs = nothing
m_Conn.close
set m_Conn = nothing
-----------
I've tried client-side cursors as well as server-side cursors, different lock types and a variety of other parameters on the recordset open but nothing works. The application fails on the "rs.Update" statement.
Application only fails with MySQL - works perfectly on Access 97 and Access 2000.
Tim.
eg.
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Invalid string or buffer length
The application works fine when pointed to an Access database (including updates) but fails with MySQL.
I have all the latest drivers and software on my PC (running Windows NT) and have just installed the version 3.23.36 of MySQL (running on a Unix machine). I've also tried older versions of MySQL - 3.22 and 3.21
An example piece of code follows -
sSQL = "SELECT * FROM UserLogon WHERE ..."
set m_Conn = server.CreateObject("adodb.connection"
m_Conn.Open DB_DSN
' open recordset and find user's logon details
set rs = server.CreateObject("adodb.recordset"
rs.CursorLocation = adUseServer
rs.Open sSQL, m_Conn, adOpenKeyset, adLockOptimistic
if rs.EOF then ' user name not found
sAttemptLogin = "User name or password invalid"
elseif bCheckExpired(rs("Expires"
sAttemptLogin = "Your account has expired. Please contact... "
elseif rs("Frozen"
sAttemptLogin = "Your account has been frozen. Please contact..."
elseif rs("Password"
sAttemptLogin = "User name or password invalid"
rs("Attempts"
if rs("Attempts"
sAttemptLogin = "Too many failed attempts - account frozen. Contact..."
rs("Frozen"
end if
rs.Update
else ' Login successful
rs("Attempts"
Session("LastOn"
rs("LastOn"
rs.Update
sAttemptLogin = "OK"
end if
' clean up recordset and close database connection
rs.Close
set rs = nothing
m_Conn.close
set m_Conn = nothing
-----------
I've tried client-side cursors as well as server-side cursors, different lock types and a variety of other parameters on the recordset open but nothing works. The application fails on the "rs.Update" statement.
Application only fails with MySQL - works perfectly on Access 97 and Access 2000.
Tim.