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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
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…

778 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