void gridupdate(Object sender,DataGridCommandEventArgs e)
{
string stud_id,strsql,class_id;
int introw;
TextBox obj;
introw=e.Item.ItemIndex;
obj=(TextBox)dg.Items[introw].Cells[4].Controls[0];
class_id=obj.Text;
stud_id=dg.DataKeys[introw].ToString();
strsql="update studentinfo set class_id='" + class_id + "' where stud_id='" + stud_id + "'";
SqlConnection sqlcon=new SqlConnection("Data Source=localhost;uid=sa;pwd=246770397;Initial Catalog=student");
sqlcon.Open();
SqlCommand sqlcommand=new SqlCommand();
sqlcommand.Connection=sqlcon;
sqlcommand.CommandText=strsql;
sqlcommand.ExecuteNonQuery();
sqlcon.Close();
sqlcon=null;
sqlcommand=null;
dg.EditItemIndex=-1;
bindgrid();
}