473,508 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to pass parameters to stored procedure, which is used by sqlDataSource

8 New Member
I want to bind GridView with sqlDataSource like following
Expand|Select|Wrap|Line Numbers
  1. sqlDataSource1.SelectCommand = "GET_TRACKING_INFO";
  2. sqlDataSource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
  3.  
  4. sqlDataSource1.SelectParameters.Add("Group_code",TypeCode.String, "1");
  5. sqlDataSource1.SelectParameters[0].Direction =ParameterDirection.Input; 
  6.  
  7. GridView1.DataSource = sqlDataSource1;
  8. GridView1.DataBind();
But raises error "Procedure or function GET_TRACKING_INFO has too many arguments specified"

When I execute this stored procedure in SQL query analyzer it works fine, there is no other parameter is used.

Please tell me what is wrong with it. Very urgent.
Aug 8 '06 #1
3 22365
josephhamilton1
1 New Member
GET_TRACKING_INFO takes one argument I'm guessing.

You're probably not clearing you input parameters on the 2nd time through.
Put this at the beginning of the sub to be sure:

sqlDataSource1.SelectParameters.Clear()

Otherwise, be sure that you're SP really does take a parameter.
Feb 3 '09 #2
hajoabdul
7 New Member
@nitinp
''''''''''''''''''''''''''''''

The reason for that error coming from your stored procedure is due to the fact that not all the parameters are being declared, either the ones in the stored procedures are less than the ones on the interface vice versa, so go through the both phases and make sure that there is equality in parameters
Mar 5 '09 #3
Frinavale
9,735 Recognized Expert Moderator Expert
Check out these articles for an example:
Mar 9 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4572
by: Jeff Thur | last post by:
I am running a SQL Stored Procedure that will give the user a count of how many records are in the database as per certain criteria. I'm using the Execute Scalar Method. I have no problem passing...
7
21588
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
4
5273
by: CsharpGuy | last post by:
I took over an web app (C#) were the developer put everything in a has table then called a method to execute a stored procedure, now I'm running into some issues were if I do an update and a NULL...
4
2219
by: Phillip Vong | last post by:
I'm a newbie using VS2005 to learn and test. I'm testing against the Northwind DB. I created a simple variable called "myVariable" and I assigned it the character "c". I want my SQL query to use...
0
2374
by: Mike P | last post by:
Where exactly are the updateparameters of a gridview picked up from? I have created 2 very similar gridviews and given the updateparameters the same names as in my edititemtemplates. Yet this...
3
8201
by: Joseph Lu | last post by:
Hi, all I have a stored procedure created in SQL Server like the following lines. // stored proceudre code starts here CREATE PROCEDURE sp_insertdata @strdata varchar(250) , @rsult BIT...
0
1014
by: =?Utf-8?B?Q0JLb3dpdHo=?= | last post by:
Don't know if this is a bug or a feature. I have a SQLDatasource that calls a stored procedure with 2 parameters. The default values are -1 and ''. When I set a breakpoint in the 'Selecting'...
3
2559
by: Homer J. Simpson | last post by:
I have the following stored procedure: ALTER PROCEDURE . AS BEGIN SET NOCOUNT ON; SELECT COUNT(*) FROM QUICKNOTES END ....and the following data source in my .aspx file:
5
2594
by: CyberSoftHari | last post by:
I am trying to get an output Parameters value from a stored procedure using sqlDataSource in asp.net 2.0. But I only get a null value for the output Parameters. Can someone Point me to get value? ...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7124
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
7326
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,...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7498
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...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.