K
Kel
I am currently trying to pass the SqlDataSource below a paramter set in
the code-behind (C#) My stored procedure takes one parameter @AID
varchar(25).
<asp:SqlDataSource ID="ListEmpSource" Runat="server"
SelectCommand="dbo.usp_ListEmps"
ConnectionString="Server=(local);Database=Test;Trusted_Connection=yes"
SelectCommandType="StoredProcedure" >
<SelectParameters>
<asparameter Name="AID" Direction="input" Type="string"
DefaultValue="username" />
</SelectParameters>
</asp:SqlDataSource>
Then in the codebehind I try to do this (one of many solutions I've
tried)
string strUserName = User.Identity.Name;
ListEmpSource.Selecting += new
SqlDataSourceSelectingEventHandler(ListEmpSource_Selecting);
//Event Handler:
public void ListEmpSource_Selecting(object sender,
SqlDataSourceSelectingEventArgs e)
{
e.Command.Parameters["@AID"].Value = strUserName;
}
Thanks in advance...
the code-behind (C#) My stored procedure takes one parameter @AID
varchar(25).
<asp:SqlDataSource ID="ListEmpSource" Runat="server"
SelectCommand="dbo.usp_ListEmps"
ConnectionString="Server=(local);Database=Test;Trusted_Connection=yes"
SelectCommandType="StoredProcedure" >
<SelectParameters>
<asparameter Name="AID" Direction="input" Type="string"
DefaultValue="username" />
</SelectParameters>
</asp:SqlDataSource>
Then in the codebehind I try to do this (one of many solutions I've
tried)
string strUserName = User.Identity.Name;
ListEmpSource.Selecting += new
SqlDataSourceSelectingEventHandler(ListEmpSource_Selecting);
//Event Handler:
public void ListEmpSource_Selecting(object sender,
SqlDataSourceSelectingEventArgs e)
{
e.Command.Parameters["@AID"].Value = strUserName;
}
Thanks in advance...