Solved

VB6:  connecting the dots from code to the Data Environment object to a stored proc?

Posted on 2003-11-10
3
303 Views
Last Modified: 2013-12-25
So I've got a stored proc in my SQL Server2K db, and the stored proc is called fred.  
It's expecting an int from the code, and it will return a bunch of records.

I want to put this stored proc into my global Data Environment object (cleverly named "de1"), and then, from the code, call the Data Environment/stored proc (passing an integer), and get the results in a local recordset in my code.

Can someone show me a simple code example (with explanation, preferably) that illustrates these things?

Thanks!
0
Comment
Question by:edmund_mitchell
  • 2
3 Comments
 
LVL 29

Expert Comment

by:leonstryker
ID: 9716097
0
 
LVL 4

Author Comment

by:edmund_mitchell
ID: 9716781
Leon --

No choice on the DE, unfortunately -- at least for now.   I looked at that URL, and I didn't see anything that related to my question.  A mistake?
0
 
LVL 29

Accepted Solution

by:
leonstryker earned 250 total points
ID: 9716937
Sorry that was a wrong link.  I think you are looking for something like this:

Sub GetRecords()
Dim strSQL as String
    strSQL = "Exec fred " & Text1.Text
    With de1.rsCmd1
        If  .State=adStateOpen  Then .Close
        .Source = strSQL
        .Open
    End With
   
    If de1.rsCmd1.EOF and de1.rsCmd1.BOF Then
       MsgBox "There are records"
    Else
       MsgBox "There are " & de1.Recordset.RecordCount & " records in the recordset"
    End If
End Sub
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

746 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

12 Experts available now in Live!

Get 1:1 Help Now