Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   How to call parameterized stored procedure to return result set? (http://www.velocityreviews.com/forums/t93620-how-to-call-parameterized-stored-procedure-to-return-result-set.html)

Lacka 12-31-2004 02:01 PM

How to call parameterized stored procedure to return result set?
 
Hi,

If I have a stored procedure in my database, that has two parameters (say @a
nvarchar(50) and @b int), and returns the result of a SELECT statement
(returns a result set), how can I set up the parameters, how can I call it,
and how can I iterate through the rows of the returned resultset?

thanks,
Lacka



Karl Seguin 12-31-2004 02:54 PM

Re: How to call parameterized stored procedure to return result set?
 
Lacka, I answered how to return iterate through it in your other post, as
for your two other questions:

Dim connection As New SqlConnection("...")
Dim command As New SqlCommand("Your sp name", connection)
command.CommandType = CommandType.StoredProcedure
command.Parameters.Add("@a", SqlDbType.NVarChar, 50).Value = "some
value"
command.Parameters.Add("@b", SqlDbType.Int).Value = 1
Dim da As New SqlDataAdapter(command)
Try
Dim ds As New DataSet
connection.Open()
da.Fill(ds)
Finally
connection.Dispose()
command.Dispose()
da.Dispose()
End Try

--
MY ASP.Net tutorials
http://www.openmymind.net/


"Lacka" <lacka@chello.hu> wrote in message
news:en%2327E07EHA.2196@TK2MSFTNGP14.phx.gbl...
> Hi,
>
> If I have a stored procedure in my database, that has two parameters (say

@a
> nvarchar(50) and @b int), and returns the result of a SELECT statement
> (returns a result set), how can I set up the parameters, how can I call

it,
> and how can I iterate through the rows of the returned resultset?
>
> thanks,
> Lacka
>
>




Lacka 12-31-2004 03:39 PM

Re: How to call parameterized stored procedure to return result set?
 
Thanks!




All times are GMT. The time now is 08:45 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.