Connecting Tech Pros Worldwide Help | Site Map

update database when datagridview changes

Newbie
 
Join Date: Aug 2007
Posts: 11
#1: Feb 4 '09
here's my code in filling a datagridview,which i retrieve from database mysql,

Expand|Select|Wrap|Line Numbers
  1.         dim sql as String
  2.         sql = "SELECT * FROM table_user"
  3.         Dim myData As New DataTable
  4.  
  5.         comm.Connection = conn
  6.         conn.Open()
  7.  
  8.        ' comm.CommandType = CommandType.Text
  9.         comm.CommandText = sql
  10.         myAdapter.SelectCommand = comm
  11.         myAdapter.Fill(myData)
  12.  
  13.  
  14.        DataGridView1.DataSource = myData
  15.  
  16.  
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
Newbie
 
Join Date: Aug 2007
Posts: 11
#2: Feb 4 '09

re: update database when datagridview changes


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

Expand|Select|Wrap|Line Numbers
  1.  
  2. myAdapter.Update(myData , "table_user")
  3.  
  4.  
Reply