Stored Proc with an Exec (str)

Posts   
 
    
uydo
User
Posts: 43
Joined: 09-Dec-2003
# Posted on: 30-Dec-2003 01:46:39   

Hi Otis,

By some reason, I defined a Stored Proc as follow:

create proc proc1 @para1 nvarchar(10) as DECLARE @ProcedureToExecute varchar(8000) SET @ProcedureToExecute = 'SELECT * FROM USER' if (para1 !='') SET @ProcedureToExecute = @ProcedureToExecute + ' WHERE [USERID] LIKE ''' + @para1 +'%'''

EXEC (@ProcedureToExecute)

This SP when executed will return a resultset. But in llblgenpro I see it under Action Stored Procedure Call. Is there any way that we can define which one(s) will be in either of the Action or Retrieval SP Call?

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39625
Joined: 17-Aug-2003
# Posted on: 30-Dec-2003 10:37:28   

Yes you can simple_smile Because there is no way to determine if an sproc has a resultset in SqlServer, I have to use a trick used by .NET to retrieve a schema from a stored proc. This not always works correctly, but it's the only option. Because it fails sometimes you can correct it by specifying the amount of resultsets it returns in the Catalog Explorer. Browse to the stored procedure and you'll see 'Amount resultsets'. Click that node open and you'll see a number (#0 in your case). Select it and press F2 or click with your RMB on that #x number. You can now change the number to for example 1 (which will result in a datatable) or 2..n (which will result in a dataset containing all resultsets).

You then have to re-add the stored proc to your project in the project explorer.

Frans Bouma | Lead developer LLBLGen Pro
uydo
User
Posts: 43
Joined: 09-Dec-2003
# Posted on: 30-Dec-2003 16:41:17   

I got it!. I would've explored the GUI more!. Thanks,