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,891 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

895 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

13 Experts available now in Live!

Get 1:1 Help Now