473,395 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

SqlDataSource Parameterized Stored Procedure Problem!!

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;Tru sted_Connection=yes"
SelectCommandType="StoredProcedure" >

<SelectParameters>
<asp:Parameter 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_S electing);

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

Thanks in advance...

Jan 5 '07 #1
0 998

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
2
by: Rhino | last post by:
I am getting an sqlcode of -927 when I execute SQL within a COBOL stored procedure in DB2 OS/390 Version 6 on OS/390. I have looked at the error message for that condition and tried everything I...
5
by: Timppa | last post by:
Hi, Could anyone help me with my problem ? Environment: Access 2000 and Sql Server 2000. I have a stored procedure as follows: DROP table1 SELECT alias1.field1,alias2.field2,table2.field6...
3
by: Bilbo | last post by:
I have a a headscratcher here: I have a form that when submitted should do 2 things when a user enters data and then clicks the Add button. Here goes: 1. Call a stored procedure called...
2
by: Lacka | last post by:
Hi, If I have a stored procedure in my database, that has two parameters (say @a nvarchar(50) and @b int), and returns the result of a SELECT statement (returns a result set), how can I set up...
1
by: David Hearn | last post by:
I have a SQLDataSource control on one of my web forms. The stored procedure that I am connecting to has two parameters that need to be passed in and one that is returned. One of the parameters I am...
1
by: Sheldon Penner | last post by:
I have been trying to build a web form using the SQL Data Adapter Configuration Wizard to create a dataset based on a parameterized stored procedure. I find that if I select "Use existing stored...
0
TonFrere
by: TonFrere | last post by:
Hello, I'm building a windows form application in Visual C# using VS 2005. On my form I need to populate a combobox with Invoices# linked to the current reccord's Order# value. This means that: -...
0
by: Mirazul Hasan | last post by:
Hi, I am facing a problem with stored procedure in case of "OdbcConnection". The code is given below:- OdbcConnection conn = new OdbcConnection(connstring); conn.Open(); ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.