Gridview Stored Procedure output paramters or return value

L

LehrSJ

I have a gridview in ASP.Net 2.0. I'm using a SQLDataSource and the
SelectCommand and UpdateCommand use a stored procedure. I have an output
parameter in the UpldateCommand. How do I get the value that is returned
from this parameter? Or if it was a return value, how would I get that?

Thank you.
 
S

Steven Cheng[MSFT]

Hi LehrSJ,

Welcome to ASPNET newsgroup.
Regarding on the retrieving store Procedure output parameters or return
value's value when used in GridView with SqlDAtasource control in asp.net
2.0, based on my understanding, we can use the SqlDataSource control's
"updated" event, this event will be get fired after the update command (to
underlying database...) has been executed successfully... We can access
all the parameters through the

SqlDataSourceCommandEventArgs.Command.Parameters collection. e.g:

protected void SqlDataSource1_Updated(object sender,
SqlDataSourceStatusEventArgs e)
{
foreach (DbParameter param in e.Command.Parameters)
{
Response.Write("<br>" + param.ParameterName + ": " +
param.Value);
}
}

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| Thread-Topic: Gridview Stored Procedure output paramters or return value
| thread-index: AcYFv0GSp5CPHpUfRKOp5M4hvdH5XA==
| X-WBNR-Posting-Host: 70.118.231.121
| From: =?Utf-8?B?TGVoclNK?= <[email protected]>
| Subject: Gridview Stored Procedure output paramters or return value
| Date: Tue, 20 Dec 2005 15:44:02 -0800
| Lines: 8
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridcontrol:14949
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
|
| I have a gridview in ASP.Net 2.0. I'm using a SQLDataSource and the
| SelectCommand and UpdateCommand use a stored procedure. I have an output
| parameter in the UpldateCommand. How do I get the value that is returned
| from this parameter? Or if it was a return value, how would I get that?
|
| Thank you.
| --
| LehrSJ
|
 
S

Steven Cheng[MSFT]

You're welcome LehrSJ,

Have a good day!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| Thread-Topic: Gridview Stored Procedure output paramters or return value
| thread-index: AcYGL28HMusDSVNESvaNS8gmb+ltTA==
| X-WBNR-Posting-Host: 70.118.231.121
| From: =?Utf-8?B?TGVoclNK?= <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: Gridview Stored Procedure output paramters or return value
| Date: Wed, 21 Dec 2005 05:07:02 -0800
| Lines: 76
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridcontrol:14953
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
|
| Thank you, that works. That was exactly what I was looking for.
| --
| LehrSJ
|
|
| "Steven Cheng[MSFT]" wrote:
|
| > Hi LehrSJ,
| >
| > Welcome to ASPNET newsgroup.
| > Regarding on the retrieving store Procedure output parameters or return
| > value's value when used in GridView with SqlDAtasource control in
asp.net
| > 2.0, based on my understanding, we can use the SqlDataSource control's
| > "updated" event, this event will be get fired after the update command
(to
| > underlying database...) has been executed successfully... We can
access
| > all the parameters through the
| >
| > SqlDataSourceCommandEventArgs.Command.Parameters collection. e.g:
| >
| > protected void SqlDataSource1_Updated(object sender,
| > SqlDataSourceStatusEventArgs e)
| > {
| > foreach (DbParameter param in e.Command.Parameters)
| > {
| > Response.Write("<br>" + param.ParameterName + ": " +
| > param.Value);
| > }
| > }
| >
| > Hope helps. Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| > --------------------
| > | Thread-Topic: Gridview Stored Procedure output paramters or return
value
| > | thread-index: AcYFv0GSp5CPHpUfRKOp5M4hvdH5XA==
| > | X-WBNR-Posting-Host: 70.118.231.121
| > | From: =?Utf-8?B?TGVoclNK?= <[email protected]>
| > | Subject: Gridview Stored Procedure output paramters or return value
| > | Date: Tue, 20 Dec 2005 15:44:02 -0800
| > | Lines: 8
| > | Message-ID: <[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.datagridcontrol:14949
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| > |
| > | I have a gridview in ASP.Net 2.0. I'm using a SQLDataSource and the
| > | SelectCommand and UpdateCommand use a stored procedure. I have an
output
| > | parameter in the UpldateCommand. How do I get the value that is
returned
| > | from this parameter? Or if it was a return value, how would I get
that?
| > |
| > | Thank you.
| > | --
| > | LehrSJ
| > |
| >
| >
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top