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,913 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JSON Response and request in VB6 application 11 1,060
Added a column screws up code 5 78
Child Form in front 4 66
how to loop through and process two columns in excel 8 72
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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 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