Surya Vijay

Surya Vijay

  • NA
  • 31
  • 1k

Update the value in db

Aug 25 2019 3:05 PM
  1. protected void Vote_Click(object sender, EventArgs e) {  
  2.  SqlConnection sql = new SqlConnection(conf);  
  3.  try {  
  4.   foreach(GridViewRow row in voterslist.Rows) {  
  5.    CheckBox chk = (CheckBox) row.FindControl("votepoint");  
  6.    Label lblCount = (Label) row.FindControl("vote_lbl");  
  7.    if (chk.Checked) {  
  8.     String Sid = lblCount.Text;  
  9.     String nqry = "what command should i enter here? I want to increase the count of the data that i checked in checkbox after the button clicked ";  
  10.     SqlCommand cmd = new SqlCommand(nqry, sql);  
  11.     int i = cmd.ExecuteNonQuery();  
  12.    }  
  13.   }  
  14.  }  
  15.  sql.Open();  
  16. }  

Answers (7)