Home All Groups Group Topic Archive Search About

Need Store Procedure Help in ADO.NET 2.0 badly!

Author
16 Nov 2005 3:03 PM
David Hearn
I have two stored procs that I need to call in an ASP.NET 2.0 application
that I am writing. One has two input parameters that need to be sent and it
will return another. The other one also has two inout parameters and I need
to return a dataset from it. This was so simple in 1.1 through drag-and-drop
and it seems like they have made it harder in 2.0. I could drag-and-drop my
stored proc and it would automatically setup my data adapter and everything.
I can't find a way to do this in 2.0. I have searched all over for
tutorials, documentation, etc on how to accomplish this but I'm coming up
empty. Can someone enlighten me on how to accomplish these two tasks?
Detailed example code would be greatly appreciated as would links to
tutorials or other documentation.

Thanks in advance!

Author
16 Nov 2005 3:36 PM
W.G. Ryan - MVP
David - are you asking basically how to call a stored proc with Parameters
and return a query, and then how to grab an output parameter?  If so, check
out www.betav.com -> Articles -> MSDN - Retrieving the Gozoutas by Bill
Vaugh.

To fill a dataset you just do this
SqlConnection cn = new SqlConnection("ConnectionString");
SqlCommand cmd = new SqlCommand("storedprocedurename", connection);
cmd.Paramaters.Add("FirstparamName", Value);// there are multiple overloads
here but this is one of the simpler ways.
cmd.Parameters.Add("SecondParamName", Value2);//ditto
SqlDataAdapter da = new SqlDataAdapter(cmd);
MyNewDataSet ds = new MyNewDataSet();
da.Fill(ds.TableName);
Show quote
"David Hearn" <david.he***@stagparkway.com> wrote in message
news:u5yWa%23r6FHA.2552@TK2MSFTNGP10.phx.gbl...
>I have two stored procs that I need to call in an ASP.NET 2.0 application
>that I am writing. One has two input parameters that need to be sent and it
>will return another. The other one also has two inout parameters and I need
>to return a dataset from it. This was so simple in 1.1 through
>drag-and-drop and it seems like they have made it harder in 2.0. I could
>drag-and-drop my stored proc and it would automatically setup my data
>adapter and everything. I can't find a way to do this in 2.0. I have
>searched all over for tutorials, documentation, etc on how to accomplish
>this but I'm coming up empty. Can someone enlighten me on how to accomplish
>these two tasks? Detailed example code would be greatly appreciated as
>would links to tutorials or other documentation.
>
> Thanks in advance!
>
Author
16 Nov 2005 3:49 PM
David Hearn
Thanks W.G. !

Show quote
"W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message
news:%23FRuQOs6FHA.636@TK2MSFTNGP10.phx.gbl...
> David - are you asking basically how to call a stored proc with Parameters
> and return a query, and then how to grab an output parameter?  If so,
> check out www.betav.com -> Articles -> MSDN - Retrieving the Gozoutas by
> Bill Vaugh.
>
> To fill a dataset you just do this
> SqlConnection cn = new SqlConnection("ConnectionString");
> SqlCommand cmd = new SqlCommand("storedprocedurename", connection);
> cmd.Paramaters.Add("FirstparamName", Value);// there are multiple
> overloads here but this is one of the simpler ways.
> cmd.Parameters.Add("SecondParamName", Value2);//ditto
> SqlDataAdapter da = new SqlDataAdapter(cmd);
> MyNewDataSet ds = new MyNewDataSet();
> da.Fill(ds.TableName);
> "David Hearn" <david.he***@stagparkway.com> wrote in message
> news:u5yWa%23r6FHA.2552@TK2MSFTNGP10.phx.gbl...
>>I have two stored procs that I need to call in an ASP.NET 2.0 application
>>that I am writing. One has two input parameters that need to be sent and
>>it will return another. The other one also has two inout parameters and I
>>need to return a dataset from it. This was so simple in 1.1 through
>>drag-and-drop and it seems like they have made it harder in 2.0. I could
>>drag-and-drop my stored proc and it would automatically setup my data
>>adapter and everything. I can't find a way to do this in 2.0. I have
>>searched all over for tutorials, documentation, etc on how to accomplish
>>this but I'm coming up empty. Can someone enlighten me on how to
>>accomplish these two tasks? Detailed example code would be greatly
>>appreciated as would links to tutorials or other documentation.
>>
>> Thanks in advance!
>>
>
>

AddThis Social Bookmark Button