473,413 Members | 1,679 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,413 software developers and data experts.

getting erorr Procedure 'up_reason' expects parameter '@EmployeeNominationID', which

i am trying to dispaly a datagrid but getting the erorr please any one help me with this.
Expand|Select|Wrap|Line Numbers
  1. private void Page_Load(object sender, System.EventArgs e)
  2.         {
  3.             // Put user code to initialize the page here
  4.          SqlConnection oConn=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["oConn"]);
  5.  
  6.             SqlDataAdapter da=new SqlDataAdapter("up_reason", oConn);
  7.  
  8.             DataSet ds=new DataSet(); 
  9.  
  10.             da.SelectCommand.CommandType=CommandType.StoredProcedure;
  11.             string employeenominationid;
  12.             employeenominationid=Request.QueryString ["employeenominationid"];
  13.  
  14.             SqlParameter obj=new SqlParameter("@EmployeeNominationid",SqlDbType.Int);
  15.                 obj.Value=employeenominationid;
  16.  
  17.  
  18.             oConn.Open();
  19.             da.SelectCommand.ExecuteNonQuery();
  20.             oConn.Close();
  21.  
  22.             da.Fill(ds) ;
  23.  
  24.             this.garidreason .DataSource=ds;
  25.             this.DataBind();
  26.  
  27.             da.Dispose(); 
  28. }
  29.  
  30.  
  31.  
and my store procedure is like this
Expand|Select|Wrap|Line Numbers
  1. CREATE  PROCEDURE dbo.up_reason
  2.  @EmployeeNominationID int
  3. --set @employeenominationid='1'
  4. AS
  5. select dbo.employeenominations.nomineefirstname,dbo.employeenominations.nomineelastname,dbo.reason.reason
  6.  FROM    dbo.EmployeeNominations INNER JOIN
  7.          dbo.Reason ON dbo.EmployeeNominations.EmployeeNominationid = dbo.Reason.Employeenominationid
  8. where dbo.reason.employeenominationid=@EmployeeNominationid
  9. GO
  10.  
  11.  
  12.  
Aug 23 '07 #1
1 1137
bakpao
21
The problem is the stored procedure is missing the parameter @EmployeeNominationID. Although you have created that parameter, you have not attached it to the command.
Expand|Select|Wrap|Line Numbers
  1. obj.Value=employeenominationid;
  2.  
  3. da.SelectCommand.Parameters.Add(obj);
  4.  
  5. oConn.Open();
  6.  
Aug 27 '07 #2

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

Similar topics

1
by: Senthil | last post by:
Hi, I created a stored procedure in the sql server. I try to insert a record from the aspx page. But I keep getting this error, "procedure expects parameter <@firstname>, which was not...
7
by: ashtek | last post by:
Hi, I have a generic function that executes a stored procedure & returns a data table. Code: === public static DataTable ExecuteStoredProcedure(string strProc,SqlParameter paramArray) {...
1
by: jfturcott | last post by:
Prepared statement '(@p1 int,@p2 tinyint,@p3 varchar(8000),@p4 varchar(8000),@p5 bit' expects parameter @p1, which was not supplied. I get the above error when trying to update a datagridview to...
0
by: Maneesh Agarwal | last post by:
I am trying to pass a parameter to dynamically populate drop down list. I am not able to pass the parameter from my .aspx file. Here is the grid view and related ObjectDataSource. In srcLocation, the...
1
by: malayappa | last post by:
Hi All here is the error what i m getting Warning: domdocument::domdocument() expects parameter 2 to be long, string given in D:\Program Files\Apache Software...
1
by: karenkksh | last post by:
HI, protected void btnUpdate_Click(object sender, EventArgs e) { SqlConnection MyConnection; SqlCommand MyCommand; MyConnection = new SqlConnection(); ...
3
by: ghjk | last post by:
I want to expire user account in my php application. Below is my code . But i got "mktime() expects parameter 6 to be long, string given in ". Could anyone tell me what is wrong? Please.. ...
3
BRawn
by: BRawn | last post by:
Hi, I'm writing an application which needs SQL parameters to be passed, and even though I've assigned parameters to the stored procedure, I keep getting the following error message from the...
10
by: LELE7 | last post by:
My .Net code: connDO.Open(); SqlCommand comm = new SqlCommand("DOrders.dbo.p_Update", connDO); comm.CommandType = CommandType.StoredProcedure; ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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...
0
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,...
0
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...

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.