?
Solved

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

Posted on 2003-11-10
3
Medium Priority
?
315 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 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 1000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

839 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