fugio huynh

fugio huynh

  • NA
  • 51
  • 16.8k

update row from datagridview to database

Apr 23 2014 1:26 PM
Hi all
I have a script to update the value from datagridview to database
I do use a button insert ToolStripButton
but not working
hope people to help
thank !
<pre>
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
conn = New SqlConnection("")
conn.Open()
Dim query As [String] = "SELECT * FROM dtaTraLoiChoVanBan"
da = New SqlDataAdapter(query, conn)
Dim cb As New SqlCommandBuilder(da)
dt = New DataTable()
da.Fill(dt)
C1FlexGrid1.DataSource = dt
conn.Close()
End Sub
Private Sub ToolStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles ToolStrip1.ItemClicked
Select Case e.ClickedItem.Name
Case "ToolStripButton1" '---> button insert
da.Update(dt)
End Select
End Sub
</pre>