How to get values from list and put it in where condition

Posted by Ahmedsa under C# on 5/1/2018 | Points: 10 | Views : 2424 | Status : [Member] | Replies : 0
I have datagridview have check boxes checked

but my problem how to update checked box values from datagridview in database .



button1_click event

{

string subjId;

List<string> lines = new List<string>();

for (int i = 0; i < gvSubjectsList.Rows.Count; i++)

{

bool Ischecked =Convert.ToBoolean(gvSubjectsList.Rows[i].Cells["Select"].Value);

if (Ischecked == true)

{

subjId = gvSubjectsList.Rows[i].Cells["SubjectId"].Value.ToString();

lines.Add(subjId);

}

}

//update courses set courseStatus = true where subjId found in lines



}


my problem how to

//update courses set courseStatus = true where subjId found in lines

How to write query select in c# to get what numbers found in list ?

update courses set courseStatus = true where ??????

what i write in place of ?????????

thanks




Responses

(No response found.)

Login to post response