Hello,
I have VB 2005 Express Edition and i'm trying to understand the DataGridView control...
I have DataGridView "GrdSpec" connected to my Access db:
DaTbSpec = New OleDb.OleDbDataAdapter("Select *
from tbSpec", ConnQual)
DaTbSpec.Fill(DsTbSpec, "TbSpec")
Dim BsTbSpec As New BindingSource
BsTbSpec.DataSource = DsTbSpec.Tables(0)
GrdSpec.DataSource = BsTbSpec
and function:
Private Sub Save()
Dim myBuilder As OleDb.OleDbCommandBuilder
= New OleDb.OleDbCommandBuilder(DaTbSpec)
DaTbSpec.Update(CType(BsTbSpec.DataSource, DataTable))
End Sub
Function "Save" works fine but only when I manually change the values in my DataGridView.
But when I use something like:
GrdSpec.Rows(0).Cells(9).Value = "new value"
My Save Function doesn't work. New value is visible in grid, but the database is not changed. Anybody knows why?
Thanks in advance for any idea!
Larry
I have VB 2005 Express Edition and i'm trying to understand the DataGridView control...
I have DataGridView "GrdSpec" connected to my Access db:
DaTbSpec = New OleDb.OleDbDataAdapter("Select *
from tbSpec", ConnQual)
DaTbSpec.Fill(DsTbSpec, "TbSpec")
Dim BsTbSpec As New BindingSource
BsTbSpec.DataSource = DsTbSpec.Tables(0)
GrdSpec.DataSource = BsTbSpec
and function:
Private Sub Save()
Dim myBuilder As OleDb.OleDbCommandBuilder
= New OleDb.OleDbCommandBuilder(DaTbSpec)
DaTbSpec.Update(CType(BsTbSpec.DataSource, DataTable))
End Sub
Function "Save" works fine but only when I manually change the values in my DataGridView.
But when I use something like:
GrdSpec.Rows(0).Cells(9).Value = "new value"
My Save Function doesn't work. New value is visible in grid, but the database is not changed. Anybody knows why?
Thanks in advance for any idea!
Larry