Results 1 to 3 of 3

Thread: stored procedure question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    70

    stored procedure question

    I am currently successfully running a stored procedure in sql server 2000 query analyzer, by inputting the proper parameters. However, when I try to run it with the vb data environment, it bugs out telling me there is no recordset. I am supplying the exact same parameters in vb which work in sql?


    I have also triple checked that the stored procedure return recordset checkbox is set to true, in the data environment


    Has anyone ever had this seemingly simple problem before. My stored procedure contains dynamic SQL that is the only hangup that I can see....

    CREATE PROCEDURE sp_GetOverseastoOverseasCost @Region1 char(10), @Region2 char(10), @Rank char(20)
    AS
    declare @SQLStatement varchar(255)

    set @SQLStatement= 'select [' + @Rank + '] from tblIICT where R1= (' + '''' + @Region1 + '''' + ') AND R2=( ' + '''' + @Region2 + '''' +' )'

    print @sqlstatement
    exec(@SQLStatement)
    GO

  2. #2
    Fanatic Member Mr.No's Avatar
    Join Date
    Sep 2002
    Location
    Mauritius
    Posts
    651
    Add these lines after the declare statement:

    SET NOCOUNT ON
    SET ANSI_WARNINGS OFF


    And then may be you should comment the print statement when you run it through VB.

    At the end of the stored procedure add

    SET NOCOUNT OFF
    Last edited by Mr.No; Oct 8th, 2002 at 01:52 AM.
    Using VB.NET 2003/.NET 1.1/C# 2.0
    http://del.icio.us/rajoo
    Blow your mind, smoke gunpowder
    Ashes to ashes, dust to dust
    If God won't have you, the devil will. - Author unknown
    Don't follow me, I'm lost too ...

  3. #3
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446
    try to avoid the Dynamic Sql Statements in Stored Procedure. It will reduce the Peroformence.


    for more information
    prasad

Posting Permissions

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



Click Here to Expand Forum to Full Width