Solved

Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

Posted on 2002-07-29
4
8,889 Views
Last Modified: 2012-06-27
I am using VB6 and ADO (also using ODBC) and in the middle of my loop I get this error message: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. (error # -2147217887)
I already know which record is causing the problem but I don't know how to fix it and how to prevent this from happening again.
The data is in Sybase and defined as "Money" and my variable was declared as Currency. If I use Power builder to retrieve the data the error does not occur.
Here is the code:

Set RSPrem = New ADODB.Recordset
RSPrem.CursorLocation = adUseServer
RSPrem.CursorType = adOpenForwardOnly
RSPrem.ActiveConnection = Conn
RSPrem.LockType = adLockOptimistic
RSPremString = "SELECT PLAN_CODE, PREMIUM, TYPE FROM TXPREMIUM " & _
"WHERE SSN = '" & strSSN & " '" & _
"AND AUDIT_STAMP = Convert(DateTime, '" & strAudit & " ') " & _
"AND Convert(char,REQUEST_NUMBER) = '" & strRequest & " '"
RSPrem.Open RSPremString, Conn
Do While RSPrem.State = adStateExecuting
  UpdateLogDisplay ("Executing SQL Prem")
Loop
       
Do While Not RSPrem.EOF Or Not (WatcherActive)
 If Not IsNull(RSPrem.Fields("PREMIUM").Value) Then
   Select Case (RSPrem.Fields("PLAN_CODE").Value)
        Case "AA", "A1"
          curPremium1 = (RSPrem.Fields"PREMIUM").Value)
          strPlanCode = (RSPrem.Fields("PLAN_CODE").Value)
        Case "AB", "A2"
          curPremium2 = (RSPrem.Fields"PREMIUM").Value)
          strPlanCode = (RSPrem.Fields("PLAN_CODE").Value)
        Case "AC", "A3"
          curPremium3 = (RSPrem.Fields("PREMIUM").Value)
          strPlanCode = (RSPrem.Fields("PLAN_CODE").Value)
        Case "AD", "A4"
          curPremium4 = (RSPrem.Fields("PREMIUM").Value)
          strPlanCode = (RSPrem.Fields("PLAN_CODE").Value)
   End Select
 End If
RSPrem.MoveNext
Loop

***I found a work around Thanks to a comment made by rkot2000.
On my Select statment I use the convert to char on the PREMIUM field, now it look like this:

RSPremString = "SELECT PLAN_CODE, " & _
"PREMIUM = Convert(char,PREMIUM), TYPE FROM TXPREMIUM " & _
"WHERE SSN = '" & strSSN & " '" & _
"AND AUDIT_STAMP = Convert(DateTime, '" & strAudit & " ') " & _
"AND Convert(char,REQUEST_NUMBER) = '" & strRequest & " '"
0
Comment
Question by:SilmaraFlor
4 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7185502
Post the relevant code.

Anthony
0
 
LVL 5

Expert Comment

by:jayeshshah
ID: 7185539
could you please show the code.
- Jayesh
0
 
LVL 5

Accepted Solution

by:
rkot2000 earned 200 total points
ID: 7185622
the value is to big
for example you have a field with size 5 and you are trying to set 'aaaaaa'

set the break point to break on all errors and check your variable.
maybe you have a value with bigger precession

0
 

Author Comment

by:SilmaraFlor
ID: 7185908
***I found a work around Thanks to a comment made by rkot2000.
On my Select statment I use the convert to char on the PREMIUM field, now it look like this:

RSPremString = "SELECT PLAN_CODE, " & _
"PREMIUM = Convert(char,PREMIUM), TYPE FROM TXPREMIUM " & _
"WHERE SSN = '" & strSSN & " '" & _
"AND AUDIT_STAMP = Convert(DateTime, '" & strAudit & " ') " & _
"AND Convert(char,REQUEST_NUMBER) = '" & strRequest & " '"  
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now