F
facicad
Look my prog. I have combobox where is have all tables names of access
file. The user select one table and the content is show in datagrid. The
user can add, erase or modify some record or row. Until now is ok but went
I want to update access file, VB send me error. Some body can help me
Dim myCnn As New OleDb.OleDbConnection
Dim objDataAdapteur As OleDbDataAdapter
Dim objDataSet As New Data.DataSet
Dim objDataTable As DataTable
----------------------------------------------------------------------------
---------------------------------------------------------------
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
myCnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
& AccessFile & ";"
myCnn.Open()
Dim strSQL As String = "SELECT * FROM [" & TableName & "]"
objDataAdapteur = New OleDb.OleDbDataAdapter(strSQL, myCnn)
Dim objCB As OleDb.OleDbCommandBuilder = New
OleDb.OleDbCommandBuilder(objDataAdapteur)
objDataAdapteur.Fill(objDataSet, TableName)
objDataTable = objDataSet.Tables(TableName)
DataGrid1.SetDataBinding(objDataTable, "")
End Sub
----------------------------------------------------------------------------
--------------------------------------------------------------
'Click on button to copy modify on datagrid in access file
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
objDataAdapteur.Update(objDataSet, TableName)
myCnn.Close()
End Sub
file. The user select one table and the content is show in datagrid. The
user can add, erase or modify some record or row. Until now is ok but went
I want to update access file, VB send me error. Some body can help me
Dim myCnn As New OleDb.OleDbConnection
Dim objDataAdapteur As OleDbDataAdapter
Dim objDataSet As New Data.DataSet
Dim objDataTable As DataTable
----------------------------------------------------------------------------
---------------------------------------------------------------
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
myCnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
& AccessFile & ";"
myCnn.Open()
Dim strSQL As String = "SELECT * FROM [" & TableName & "]"
objDataAdapteur = New OleDb.OleDbDataAdapter(strSQL, myCnn)
Dim objCB As OleDb.OleDbCommandBuilder = New
OleDb.OleDbCommandBuilder(objDataAdapteur)
objDataAdapteur.Fill(objDataSet, TableName)
objDataTable = objDataSet.Tables(TableName)
DataGrid1.SetDataBinding(objDataTable, "")
End Sub
----------------------------------------------------------------------------
--------------------------------------------------------------
'Click on button to copy modify on datagrid in access file
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
objDataAdapteur.Update(objDataSet, TableName)
myCnn.Close()
End Sub