Hi,
Intialy i extracting data from Sql server database and displaying in gridview of a webform`s page load event, that fucnttion is as follows:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetData();
}
}
private void GetData()
{
GViewIncidentDetails .DataSource = dbpinsidentdetails.RunSPReturnDataSet ("GET_INCIDENTDETAILS");
GViewIncidentDetails.DataBind();
}
following is the code for function RunSPReturnDataSet():
public DataSet RunSPReturnDataSet(string spname)
{
SqlDataAdapter dataAdapter=new SqlDataAdapter();
DataSet dataSet=new DataSet();
Com.CommandText=spname;
Com.CommandType =CommandType.StoredProcedure;
dataAdapter.SelectCommand =Com;
dataAdapter.Fill(dataSet);
return dataSet;
}
}
after displaying data in gridview i am editing one record by calling "RowUpdating" event of gridview by folling code:
protected void GViewIncidentDetails_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try
{
GridViewRow r = GViewIncidentDetails.Rows[e.RowIndex];
dbpinsidentdetails.InputParam("@iIDID", Convert.ToInt32(r.Cells[1].Text));
DropDownList ddl1 = (DropDownList)r.Cells[8].Controls[0];
string ddlstring = ddl1.SelectedValue.ToString();
dbpinsidentdetails.InputParam("@iStatus", ddlstring);
dbpinsidentdetails.RunSPReturnVoid("UPDATE_INCIDENTDETAILS");
GViewIncidentDetails.EditIndex = -1;
GetData(); }
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
following is the code for function RunSPReturnVoid():
public void RunSPReturnVoid(string spname)
{
Com.CommandText =spname;
Com.CommandType =CommandType.StoredProcedure;
Com.ExecuteNonQuery();
}
In this function after calling a SP for updation, i called the GetData() function to display the data after changes which are made now to gridview.
I am getting an error here that is "
Procedure GET_INCIDENTDETAILS has no parameters and arguments were supplied.
"
any way record is updateing correctly.
Actualy GET_INCIDENTDETAILS stored procedure does`t have any arguments, here problem is arguments of UPDATE_INCIDENTDETAILS are passing to GET_INCIDENTDETAILS stored procedure.
Please any body explain me what is the reason for this error, what i need to do avoid this error.
Please help me.
Thanks in addvance
K Uday