I am trying to insert a record into a table from multiple threads. It seems that if two threads are trying to do it at the same time then I get:
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
I am opening up a new database connection for each thread. It seems to work if only one thread is active. Is there something going on with locking or "set count on" or something? There are no triggers on the table.
Thanks
Here is the code:
OpenBackendDatabase(cn, m_sPrivateConnectionString)
cmd.ActiveConnection = cn
cmd.ActiveConnection.CursorLocation = ADODB.CursorLocationEnum.adUseClient
cmd.Parameters.Append(cmd.CreateParameter("", ADODB.DataTypeEnum.adVarChar, ADODB.ParameterDirectionEnum.adParamInput, 64, sRCPTTo))
cmd.Parameters.Append(cmd.CreateParameter("", ADODB.DataTypeEnum.adInteger, ADODB.ParameterDirectionEnum.adParamInput, , bounce.BounceType))
cmd.CommandText = "insert into tblBounceLog (VERPS,BounceType) values (?,?)"
cmd.Execute()
cn.Close()
Ok, it seems the issue with threads is not the primary issue but could be something else explained below.
Strange thing is, if I convert this insert to just a simple cn.execute statement it works every time:
cn.Execute("insert into tblBounceLog (VERPS,BounceType) values ('" & sRCPTTo & "'," & bounce.BounceType & ")")
So it seems the multiple-step issue is happening only when the Command is used. Can anyone explain this or seem something that I am missing?
Thanks again