Link to home
Start Free TrialLog in
Avatar of dbabbitt
dbabbitt

asked on

ODBC--call failed Error in SQL Record Set


Hi Guys!

How do I get rid of this "ODBC--call failed." error:
                        Dim BioWebServerConnector
                        Dim BioWebMatch
                        Dim MatchResponse
                        Dim ID
                        
                        Set BioWebServerConnector = CreateObject("BioWeb2Server.Connector")
                        Set BioWebMatch = BioWebServerConnector.Match
                        
                        Set rs = Server.CreateObject("ADODB.Recordset")
                        rs.Open "Biometric_Transactions", cn, adOpenKeyset, adLockPessimistic, adCmdTable
                        rs.AddNew
                        rs("UserID") = Request.Form("User_Logon")
                        rs("VerifyFeature") = BioWebMatch.Decode(Request.Form("VerifyFeature"))
                        rs("SupportedDevice") = Request.Form("SupportedDevice")
                        rs("RemoteAddress") = Request.ServerVariables("REMOTE_ADDR")
                        rs("Approved") = 0
                        rs.Update
                        ID = rs("ID")
                        rs.Close
                        Set rs = Nothing
                        
                        If (ID = NULL) OR (Len(ID) = 0) Then
                              Dim ConnectionString, MySql
                              Dim Conn
                              ConnectionString = "DSN=BioWeb;UID=sa;PWD=Not4U2C;"
                              Set Conn = Server.CreateObject("ADODB.Connection")
                              Conn.Open ConnectionString
                              MySql = "SELECT MAX(ID) AS ID FROM Biometric_Transactions"
                              rs = Conn.Execute(MySql)
                              ID = rs("ID")
                              Conn.Close
                              Set Conn = Nothing
                        End If
                        
                        'My boss was always getting a "BioWeb2Server (0x800A005E) Invalid use of Null" error here
                        'I am now getting an "Error Type: DAO.Field (0x800A0C4A) ODBC--call failed." error here
                        MatchResponse = BioWebMatch.Result(CLng(ID))

How do I get rid of this "ODBC--call failed." error? Both the server and the client are running on the same laptop, with the IUSR account set up with access to the database.

Thanx

Dave
Avatar of sforcier
sforcier

Verify that the value stored in ID is not null by doing this:

If IsNull(ID) Then
   Response.Write "It's NULL!"
   MatchResponse = ""
Else
   MatchResponse = BioWebMatch.Result(CLng(ID))
End If

If the message "It's NULL!" is displayed, you need look at the code above to determine why (post here for help on that as well).
You'd think at least you would've used the code we wrote in the last Question to clean up you code!!!  Why don't you start with that....and then see what happens.
Avatar of dbabbitt

ASKER

I can run Microsoft Script Debugger on the server - Here's what's in the Command Window:

? ID
184

? CLng(ID)
184

? BioWebMatch.Result(CLng(ID))
ODBC--call failed.
ASKER CERTIFIED SOLUTION
Avatar of sforcier
sforcier

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sybe
>>  "Error Type: DAO.Field (0x800A0C4A) ODBC--call failed."

I hope you are not using DAO, because that is vastly outdated
In the ODBC control panel, I discovered it was not able to log in using the sa account.