asp.net - Update SQL Server from GridView with a Checkbox -


The page has a gridview with a checkbox field. And there is a button on the same page. There is an area related to the checkbox in SQL Is there an easy way to update SQL? Line not by line

Best Relationship,

You can use the following snippet to select all To return the value of the checkboxes as a comma separated strings:

  string value = string. Empty; Foreach (list item items in the list checkbox.) {If (item selected) value + = item. Value + ","; }  

You can use this value in SQL as follows:

  string sql = String.Format ("Update Table SET = selected where in Id ({0}) ", value);  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -