Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • Last Modified:

retrieving a table from a SQL server function returns table in VB6

I need to retrieve a table from a SQL server User Defined Function in VB6. How can this be accomplished? Here's the sample code I'm working with. It errors after it executes: The parameter is incorrect.

Dim aRS As New ADODB.Recordset
Dim MyCommand As New ADODB.Command

With MyCommand
            .ActiveConnection = fAdoCnn
            .CommandType = adCmdStoredProc
            .CommandText = "fn_Calculate_YTD_Totals"
            .Parameters.Refresh
            .Parameters("@RegionID") = gintRegionID
            Set aRS = .Execute
        End With
0
marshallgarza
Asked:
marshallgarza
1 Solution
 
i014354Commented:
Change the .Parameters("@RegionID") = gintRegionID line to:

With MyCommand
           .ActiveConnection = fAdoCnn
           .CommandType = adCmdStoredProc
           .CommandText = "fn_Calculate_YTD_Totals"
           .Parameters.Refresh
           .Parameters(1) = gintRegionID
           Set aRS = .Execute
       End With
0
 
CleanupPingCommented:
marshallgarza:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
DanRollinsCommented:
Moderator, my recommended disposition is:

    Accept i014354's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

Independent Software Vendors: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now