How to insert multiple rows from datagrid where checkbox is selected?
-
Hi, I'm doing a vb.net (Window Application) project. I'm retrieving data to a datagrid. It has checkbox at the 1st column (DataGridBoolColumn). User is able to check or uncheck the rows in datagrid. Once user click save, how can i insert those rows where checkbox is selected into SQL table? I found few samples but those are for asp.net. Can anyone advice me as i'm using window application. Thanks in advanced. cheers,eunice
-
Hi, I'm doing a vb.net (Window Application) project. I'm retrieving data to a datagrid. It has checkbox at the 1st column (DataGridBoolColumn). User is able to check or uncheck the rows in datagrid. Once user click save, how can i insert those rows where checkbox is selected into SQL table? I found few samples but those are for asp.net. Can anyone advice me as i'm using window application. Thanks in advanced. cheers,eunice
Hello Euince, You would have to manually insert the rows into SQL table by looping through the rows and check if the first column is checked or not. Regards, Allen
Allen Smith Software Engineer ComponentOne LLC www.componentone.com
-
Hello Euince, You would have to manually insert the rows into SQL table by looping through the rows and check if the first column is checked or not. Regards, Allen
Allen Smith Software Engineer ComponentOne LLC www.componentone.com
Hi Allen, Thanks for the tips. But how can i loop through? Is it something like this? For i = 0 To icounter - 1 If myTable.Rows(0).Item("check") = True Then Dim RawID As Object = dgResult.Item(i, 2) Dim Question As Object = dgResult.Item(i, 3) strQuery = "Insert into udtInsert (RawID,Question) values(" & RawID.ToString() & ",'" & Question.ToString() & "' )" conn.Open() cmd.CommandText = strQuery cmd.Connection = conn End If Next pls advice... thanks a lot. cheers,eunice