Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to insert multiple rows from datagrid where checkbox is selected?

How to insert multiple rows from datagrid where checkbox is selected?

Scheduled Pinned Locked Moved Visual Basic
questioncsharpasp-netdatabase
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Eunice VB junior
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • E Eunice VB junior

      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

      C Offline
      C Offline
      C1AllenS
      wrote on last edited by
      #2

      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

      E 1 Reply Last reply
      0
      • C C1AllenS

        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

        E Offline
        E Offline
        Eunice VB junior
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups