Solved

I'm getting this error of Multiple-steps OLE

Posted on 2009-04-13
4
321 Views
Last Modified: 2012-05-06
Hello,

can someone please help me?
I'm getting this error:"Multiple - Step OLE DB operation generated error. Check each ole db status values, if available. No work was done"  pointing to:
CRecordset3.Open "EXEC spGetPrivateTotalDailyCensusNew", cnn, adOpenDynamic, adLockPessimistic
all the time I run  this code:

any idea what I'm missing. I'm also attaching the procedure I'm calling
Public Sub GetPrivateDailyCensus()
 
  Dim cnn As Object
  Dim CRecordset3 As Object   'Private Avg
  
   ' Create a connection object
  Set cnn = CreateObject("ADODB.Connection")
 
   ' Connect to the database
  cnn.Provider = "SQLOLEDB"
  cnn.Open "Server=Vaio;Database=Products;User Id=admin;Password=password"
  If cnn.State <> 1 Then
    MsgBox "Could not connect to the database"
     Exit Sub
  End If
 
 
   ' Open recordset BeginNextRecordset
 
  Set CRecordset3 = CreateObject("ADODB.Recordset")
  CRecordset3.Open "EXEC spGetPrivateTotalDailyCensusNew", cnn, adOpenDynamic, adLockPessimistic
 
  Sheets("WeeklyCensus").[D4].CopyFromRecordset CRecordset3
    
 
  cnn.Close
  Set cnn = Nothing
 
End Sub

Open in new window

procedure.txt
0
Comment
Question by:Romacali
[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
  • 2
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 24133362
try this:
adOpenDynamic and adLockPessimistic to be removed from the command.
I doubt that a recordset returned from a stored procedure can be locked pessimistically.

apart from that, I would suggest the same method as in your other question (using adodb.command) :
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_24317577.html


0
 

Author Comment

by:Romacali
ID: 24133553
Hi Angell,

I took off the the adOpenDynamic and adLockPessimistic  and it gives me this error now:

Procedure ' ' expects parameter @beginDate, which was not supplied

How can I send this date from excel using the code I have?
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 24133600
0

Featured Post

Industry Leaders: 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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

632 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