Go Premium for a chance to win a PS4. Enter to Win

x
?
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
Medium Priority
?
8,960 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 600 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…
Suggested Courses

885 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