Solved

I'm getting this error of Multiple-steps OLE

Posted on 2009-04-13
4
315 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 142

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 142

Expert Comment

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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now