update database when datagridview changes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • adsaca
    New Member
    • Aug 2007
    • 11

    update database when datagridview changes

    here's my code in filling a datagridview,wh ich i retrieve from database mysql,

    Code:
            dim sql as String
            sql = "SELECT * FROM table_user"
            Dim myData As New DataTable
    
            comm.Connection = conn
            conn.Open()
    
           ' comm.CommandType = CommandType.Text
            comm.CommandText = sql
            myAdapter.SelectCommand = comm
            myAdapter.Fill(myData)
    
    
           DataGridView1.DataSource = myData
    So here's my question(just as you read from my title),
    how to update database when values in the datagrid change?

    please help,
    arjel
  • adsaca
    New Member
    • Aug 2007
    • 11

    #2
    i've already found a solution to my problem, and here's what i did.

    Code:
    myAdapter.Update(myData , "table_user")

    Comment

    Working...