Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > SqlDataSource Parameterized Stored Procedure Problem!!

Thread Tools

SqlDataSource Parameterized Stored Procedure Problem!!

Posts: n/a
I am currently trying to pass the SqlDataSource below a paramter set in
the code-behind (C#) My stored procedure takes one parameter @AID

<asp:SqlDataSource ID="ListEmpSource" Runat="server"

ConnectionString="Server=(local);Database=Test;Tru sted_Connection=yes"
SelectCommandType="StoredProcedure" >

<asparameter Name="AID" Direction="input" Type="string"
DefaultValue="username" />


Then in the codebehind I try to do this (one of many solutions I've

string strUserName = User.Identity.Name;

ListEmpSource.Selecting += new
SqlDataSourceSelectingEventHandler(ListEmpSource_S electing);

//Event Handler:
public void ListEmpSource_Selecting(object sender,
SqlDataSourceSelectingEventArgs e)
e.Command.Parameters["@AID"].Value = strUserName;

Thanks in advance...

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SqlDataSource, SQL working, Stored procedure doesn't. Parameter hell Jim Andersen ASP .Net 3 03-03-2006 09:04 PM
get an output value from a stored procedure using sqlDataSource michelle ASP .Net 3 02-14-2006 02:31 PM
SqlDataSource - Stored Procedure =?Utf-8?B?YmVub2l0?= ASP .Net 1 12-20-2005 03:28 PM
SQLDataSource and Stored Procedure Question David Hearn ASP .Net 1 10-13-2005 08:21 PM
How to call parameterized stored procedure to return result set? Lacka ASP .Net 2 12-31-2004 03:39 PM