Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

I'm getting this error of Multiple-steps OLE

Posted on 2009-04-13
4
Medium Priority
?
322 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 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

688 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