J
Jerry
This should be soooo simple but I just can't figure it out. All I
want to do is open an Excel spreadsheet, update it and write back out
again! For some reason though I can't get the update command to work.
I've tried using commandbuilder, that failed because the update
command doesn't return key column information.
Here's what I've got so far.
Dim DS As New System.Data.DataSet
Dim DA As System.Data.OleDb.OleDbDataAdapter
Dim DC As System.Data.OleDb.OleDbConnection
DC = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=" & ExcelSpreadsheet.FileName & "; Extended
Properties=Excel 8.0;")
' Select the data from POINTS sheet of the workbook.
DA = New System.Data.OleDb.OleDbDataAdapter("select * from
[Points$]", DC)
Dim CB As OleDb.OleDbCommandBuilder = New
OleDb.OleDbCommandBuilder(DA)
DA.Fill(DS,"Reference")
DataGrid2.DataSource = DS
All this seems to work, at least I don't get any errors , but how
do I write the changes back again?
TIA
Doug
want to do is open an Excel spreadsheet, update it and write back out
again! For some reason though I can't get the update command to work.
I've tried using commandbuilder, that failed because the update
command doesn't return key column information.
Here's what I've got so far.
Dim DS As New System.Data.DataSet
Dim DA As System.Data.OleDb.OleDbDataAdapter
Dim DC As System.Data.OleDb.OleDbConnection
DC = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=" & ExcelSpreadsheet.FileName & "; Extended
Properties=Excel 8.0;")
' Select the data from POINTS sheet of the workbook.
DA = New System.Data.OleDb.OleDbDataAdapter("select * from
[Points$]", DC)
Dim CB As OleDb.OleDbCommandBuilder = New
OleDb.OleDbCommandBuilder(DA)
DA.Fill(DS,"Reference")
DataGrid2.DataSource = DS
All this seems to work, at least I don't get any errors , but how
do I write the changes back again?
TIA
Doug