Multiple-Step OLE DB Error in SalesLogix

Question: Below is some code that I have in SalesLogix.  When I run this and take
out the stop statement, or say no to the debugger, the message box
shows the count to be 3 and the error message alerted is an empty
string.

When the stop statement is included, or I say yes to the debugger,
and step through, the parameter count is 6 and I get the error
“Multiple-step OLE DB operation generated errors.  Check each OLE DB
status value, if available.  No work was done.”

I can’t figure out why this is happening, any help would be appreciated.

Here is the code:

On Error Resume Next

sql = “UPDATE Table1 SET field1 = ?, field2 = ? WHERE prkey = ?”
Dim oSlxDB

Set oSlxDb = New SLX_DB
Dim cmd
Set cmd = CreateObject(“ADODB.Command”)
cmd.ActiveConnection = oSlxDb.Connection

Stop

With cmd
.CommandType = adCmdText
.Prepared = True
.CommandText = sql
.Parameters.Append .CreateParameter(“field1”, adNumeric, adParamInput, , value1)

.Parameters.Append .CreateParameter(“field2”, adDBDate, adParamInput, , value2)
.Parameters.Append .CreateParameter(“field3”, adVarChar, adParamInput, 12, value3)
MsgBox “count: ” & cmd.Parameters.Count

.Execute
End With
MsgBox “description: ” & Err.Description

Answer:  This is probably happening because if you access the parameters
collection via the debugger, the parameters are auto loaded. So, when
you append 3 more
params you have 6.  This is how you get rid of your appends and set the
values:

.Parameters(0).Value = value1
etc.

 

 

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!