SWAMY YT

SWAMY YT

  • 1.1k
  • 643
  • 30.6k

Re Facing some issues.

Aug 4 2018 9:45 AM
dear sir,
1) while showing  the  gridview in select  query i am getting error like.
("Procedure or function 'usp_ProjectLists' expects parameter '@intProjectid', which was not supplied") 
but i am not passing any parameter to check the condition in store procedure.Please anyone help me out and suggest me whats the problem, here is my code and store procedure
 
if(@Event = 'Select')
begin
select * from [dbo].[Project_Lists]
order by Projectid desc
end
 
 
public void BindProjectData()
{
try
{
CreateConnection();
OpenConnection();
cmd.CommandText = "usp_ProjectLists";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Event", "Select");
//cmd.Parameters.AddWithValue("@Projectid", Convert.ToInt32("Projectid")); // i am trying this line but no luck
sqladapter = new SqlDataAdapter(cmd);
dtSet = new DataSet();
sqladapter.Fill(dtSet);
GridViewProjectCRUD.DataSource = dtSet;
GridViewProjectCRUD.DataBind();
}
catch (Exception ex)
{
Response.Write("The Error is " + ex);
}
finally
{
CloseConnection();
DisposeConnection();
}
}
 

Answers (1)