Hello folks. Having a little trouble with a .dll and I don't know what the problem is. I am new to this stuff, so I am probably looking over something really simple. I appreciate any help.
dave
Here is the code. I am calling a query in an Access database which uses a parameter(strMessageID) to get a single value from the database, which I am storing in UpdateDB. I am not too sure about the "createparameter" part of the code...probably is part of the problem.
Public Function UpdateDB(ByVal strDbConnectionString As String, ByVal strSQL As String, ByVal strMessageID As String) As Variant
Dim oRs As New ADODB.Recordset
Dim oCmd As New ADODB.Command
Dim oConn As New ADODB.Connection
Dim Parm As Parameter
oConn.Open strDbConnectionString
oCmd.CommandText = strSQL
oCmd.CommandType = adCmdStoredProc
Set oCmd.ActiveConnection = oConn
Set Parm = oCmd.CreateParameter("variableID", adIUnknown, adParamInput, Len(strMessageID), strMessageID)
Param1.Value = strMessageID
Call oCmd.Parameters.Append(Parm)
Set Parm = Nothing
Set oRs = oCmd.Execute()
UpdateDB = oRs.getRows
oRs.Close
oConn.Close
Set oRs = Nothing
Set oCmd = Nothing
Set oConn = Nothing
End Function
I get the error message below. I am running this as a .dll from an ASP page.
Error Type:
ADODB.Command (0x800A0D5D)
Application uses a value of the wrong type for the current operation.
dave
Here is the code. I am calling a query in an Access database which uses a parameter(strMessageID) to get a single value from the database, which I am storing in UpdateDB. I am not too sure about the "createparameter" part of the code...probably is part of the problem.
Public Function UpdateDB(ByVal strDbConnectionString As String, ByVal strSQL As String, ByVal strMessageID As String) As Variant
Dim oRs As New ADODB.Recordset
Dim oCmd As New ADODB.Command
Dim oConn As New ADODB.Connection
Dim Parm As Parameter
oConn.Open strDbConnectionString
oCmd.CommandText = strSQL
oCmd.CommandType = adCmdStoredProc
Set oCmd.ActiveConnection = oConn
Set Parm = oCmd.CreateParameter("variableID", adIUnknown, adParamInput, Len(strMessageID), strMessageID)
Param1.Value = strMessageID
Call oCmd.Parameters.Append(Parm)
Set Parm = Nothing
Set oRs = oCmd.Execute()
UpdateDB = oRs.getRows
oRs.Close
oConn.Close
Set oRs = Nothing
Set oCmd = Nothing
Set oConn = Nothing
End Function
I get the error message below. I am running this as a .dll from an ASP page.
Error Type:
ADODB.Command (0x800A0D5D)
Application uses a value of the wrong type for the current operation.