Write the update query to get the updated text from the textbox control
and pass the query to this method provided below. The method returns 1 when the command executes query successfully else it returns 0.
string query = "update tablename set col1=textname1,..... where condition";
public int ExecuteCommand(string query)
{
int RowsAffected = 0;
cn = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
SqlCommand Command = null;
try
{
Command = new SqlCommand(query, cn );
RowsAffected = Command.ExecuteNonQuery();
}
catch (Exception e)
{
throw new Exception(e.Message + "<br>" + query);
}
finally
{
Command.Dispose();
Command = null;
cn.Close();
cn.Dispose();
}
return RowsAffected;
}
</br>