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

Posted on 2003-02-27
Medium Priority
Last Modified: 2012-08-13
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("@RegionID") = gintRegionID
            Set aRS = .Execute
        End With
Question by:marshallgarza
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

i014354 earned 200 total points
ID: 8034532
Change the .Parameters("@RegionID") = gintRegionID line to:

With MyCommand
           .ActiveConnection = fAdoCnn
           .CommandType = adCmdStoredProc
           .CommandText = "fn_Calculate_YTD_Totals"
           .Parameters(1) = gintRegionID
           Set aRS = .Execute
       End With

Expert Comment

ID: 8901025
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?
LVL 49

Expert Comment

ID: 8983709
Moderator, my recommended disposition is:

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

DanRollins -- EE database cleanup volunteer

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

770 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