views:

93

answers:

1

If I have a SqlDataSource with

InsertCommand="INSERT [Applications] ([UserID]) VALUES (@UserID);SELECT @ApplicationID=SCOPE_IDENTITY()"

Can I use a SessionParameter to store the returned value?

<asp:SessionParameter SessionField="__ApplicationID" Name="ApplicationID" Type="int32" Direction="Output" DefaultValue="-1" />
A: 

similar to this question
my problem was using output params from stored procedure and using them right away in Label Control or Session by using asp:ControlParameter and SessionParameter in sqldatasource whitout any extra code ,but not a chance.

it is solved with :

protected void SqlDataSourceGV_Selected(object sender, SqlDataSourceStatusEventArgs e)
{  
    Label_TotalValue.Text =  e.Command.Parameters["@TotalValue"].Value.ToString() ; 
}

What is the best possible solution ?? anybody?

imanabidi