Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Posts
    21

    Question Unanswered: When Selecting From A Table Variable To VB6 In A Sproc The Recordset Doesnt Open

    Im using ADO 2.6 With VB6
    Im creating a table variable and use it to group
    a large union

    Insert Into @MyTableVariable
    Select X
    UNION
    Select y
    UNION
    Select Z

    Select Sum(SomeField) From @MyTableVariable
    Group by Something

    the recordset in VB6 never opens when executing the sproc performing this, its strange, the query executes without reporting any errors yet the object remains closed as if it was never used.

    the same sproc works perfectly when executed from QA.

    I solved this by using a user defined function instead of the table variable and it works just fine, but I'd like to know if anyone encountered this problem and if there is a solution

    thanks

  2. #2
    Join Date
    Feb 2003
    Location
    Montreal, Canada
    Posts
    117

    Re: When Selecting From A Table Variable To VB6 In A Sproc The Recordset Doesnt Open

    Add:
    set nocount on
    at the begining of the stored proc

    Originally posted by ldba
    Im using ADO 2.6 With VB6
    Im creating a table variable and use it to group
    a large union

    Insert Into @MyTableVariable
    Select X
    UNION
    Select y
    UNION
    Select Z

    Select Sum(SomeField) From @MyTableVariable
    Group by Something

    the recordset in VB6 never opens when executing the sproc performing this, its strange, the query executes without reporting any errors yet the object remains closed as if it was never used.

    the same sproc works perfectly when executed from QA.

    I solved this by using a user defined function instead of the table variable and it works just fine, but I'd like to know if anyone encountered this problem and if there is a solution

    thanks
    Steve

  3. #3
    Join Date
    Dec 2003
    Posts
    17
    And SET NOCOUNT OFF just before you select the results you want to view.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •