Solved

I'm getting this error of Multiple-steps OLE

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

744 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

9 Experts available now in Live!

Get 1:1 Help Now