473,664 Members | 3,066 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_IN FO 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 22372
josephhamilton1
1 New Member
GET_TRACKING_IN FO 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. SelectParameter s.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
4592
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 values that the user inputs into Text boxes to my Stored Procedure. However I have a drop down list with a listing of the individual States, which the user selects. I am trying to use the SelectedValue of the drop down list but I am getting a...
7
21612
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 server ? Is it possible to use parameters in pass-through queries ? An additional question: Is it possible to connect to a database on MySQL or PostgreSQL using ADO ? Is it possible to execute pass-through queries with parameters, using ADO...
4
5287
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 is passed that the field in the db is left empty and NULL is not entered in. So how can I pass a NULL value in a hashtable, execute the stored procedure and have NULL entered in the table instead of a blank field? here is an example of the code:...
4
2226
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 this variable in the "Where" statement where it will pull up all names with the letter "c" in it. How do I pass this variable on the the WHERE statement? I thought all I had to do was use the <% %> with my variable inside and that would work...
0
2385
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 method has worked for 1 gridview and failed for the second gridview. Here is my gridview : <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:XConnectionString %>" SelectCommand="ViewForecast"...
3
8210
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 OUTPUT , @erridx CHAR(7) OUTPUT
0
1020
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' event. The 2nd parameter values shows as Nothing. Which I'm fine with. But if I don't actually set a value here and let the code run the select returns no rows. Not sure what's going on here. I've tried running the stored procedure through SQL...
3
2564
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
2617
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? SqlDataSource InsertDS = getSqlDataSource; //-----------------parameters InsertDS.InsertParameters.Add("FirstName", FirstName); ....................................... //----------------This is an Output Param
0
8437
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8778
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7375
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.