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

x
?
Solved

I'm getting this error of Multiple-steps OLE

Posted on 2009-04-13
4
Medium Priority
?
324 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
  • 2
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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 …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

916 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