Solved

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

Posted on 2003-11-10
3
305 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

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

Suggested Solutions

Title # Comments Views Activity
Excel Vlookup to move data back to source. 4 91
Excel object stays open 19 76
vb6 connector to mongodb 2 84
Need Nag Screen for Reboot if system up time is over 14 days 12 48
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

778 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