i have this stored procedure in the update command of formview
DECLARE @ResultTelID int ;
EXECUTE [CUSTOMER].[dbo].[uspUpdateClientTel]
@telephoneid
,@telephone
,@TelTypeID
,@DetailsTypeID
,@SortNo
,@ResultTelID OUTPUT
the first two varialbles are in the select query
but my doubt is how to pass values for the update parameters from the code behind
protected void FrmClient_ItemUpdating(object sender, FormViewUpdateEventArgs e)
{
string strtel =((form1.FindControl("telephoneidLabel") as Label).Text)as string;
SqlConnection conTel = new SqlConnection();
conTel.ConnectionString = Convert.ToString(ConfigurationManager.ConnectionStrings["CUSTOMERConnectionString"]);
conTel.Open();
string strcmd = "SELECT tel_type_id, details_type_id, sort_no from TELEPHONE where tel_id =" + strtel;
SqlCommand cmd = new SqlCommand(strcmd , conTel);
SqlDataReader rdrTel = cmd.ExecuteReader();
while( rdrTel.Read())
{
int TeltypeID = (int)rdrTel["tel_type_id"];
int DetailTypeID = (int)rdrTel["details_type_id"];
Int16 Sort = (Int16)rdrTel["sort_no"];
//sdsClient.UpdateParameters("TelTypeID").DefaultValue = (int)rdrTel["tel_type_id"];
}
rdrTel.Close();
conTel.Close();
}
i want to know how to assign the value of the three prameters to the update command( sdsclient is the sqldatasource for the code)
thanks for any suggestions.
Add parameter as you do with SQLCommand.. have an idea from follow code snippet.
Update their value as:
follow this asp.net forum thread for more details