using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.Sql; using System.Data.SqlClient; public partial class haldus_myymine : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } void MuudaOstuStaatus(int ostuID, int uusStaatus) { SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings ["veebipoebaasConnectionString"].ConnectionString); SqlCommand cm = new SqlCommand("UPDATE ostud SET seisund=@uusseisund " + "WHERE id=@muudetav", cn); cn.Open(); cm.Parameters.AddWithValue("uusseisund", uusStaatus); cm.Parameters.AddWithValue("muudetav", ostuID); cm.ExecuteNonQuery(); cn.Close(); } protected void tabel1_RowCommand(object sender, GridViewCommandEventArgs e) { if(e.CommandName=="makstud"){ MuudaOstuStaatus(Convert.ToInt32(e.CommandArgument), 1); } tabel1.DataBind(); } }