![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
VS2005 C# 2.0 I'm using ADO.NET and the Jet 4.0 OLE DB provider to append a row to an Excel spreadsheet. I have a data table of type System.Data.DataTable, and a table adapter of type System.Data.OleDb.OleDbDataAdapter to fill the data table. These are generated by the VS2005 dataset designer. My connection string, created using the Data Links wizard is Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\FootAnalNovel.xls; Extended Properties="Excel 8.0;HDR=Yes";Persist Security Info=False 1. faAdapter.Fill() to fill the table from the worksheet 2. Create a new empty row for the table. 3. Set values for elements of the row. 4. Add the row to the table. 5. Call faAdapter.Update() to send results back to the spreadsheet In the target spreadsheet I observe: 1. The row was added. The first column was autoincremented as desired. 2. All numeric columns in the sheet, including dates, are correct. 3. The header line has not been modified - that is correct. 4. All text columns in the table have been corrupted. But, in a very particular way: they are filled in row by row by text that was originally in the sheet, in the order that it appeared originally in the sheet. Both originally empty cells and filled cells are overwritten. Thanks in advance for your help. Jim |
#3
| |||
| |||
|
|
A follow-up to my own posting. I finally got this working. My target Excel worksheet had been created by importing a table from a VFP database. Apparently there was something wrong with that. I tried creating the Excel worksheet directly, creating the same columns that were in the VFP worksheet. This now works without any corruption of the Excel worksheet. I don't know what was wrong with the Excel sheet created by importing from VFP. Any thoughts? Jim "Jim Walsh" wrote: VS2005 C# 2.0 I'm using ADO.NET and the Jet 4.0 OLE DB provider to append a row to an Excel spreadsheet. I have a data table of type System.Data.DataTable, and a table adapter of type System.Data.OleDb.OleDbDataAdapter to fill the data table. These are generated by the VS2005 dataset designer. My connection string, created using the Data Links wizard is Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\FootAnalNovel.xls; Extended Properties="Excel 8.0;HDR=Yes";Persist Security Info=False 1. faAdapter.Fill() to fill the table from the worksheet 2. Create a new empty row for the table. 3. Set values for elements of the row. 4. Add the row to the table. 5. Call faAdapter.Update() to send results back to the spreadsheet In the target spreadsheet I observe: 1. The row was added. The first column was autoincremented as desired. 2. All numeric columns in the sheet, including dates, are correct. 3. The header line has not been modified - that is correct. 4. All text columns in the table have been corrupted. But, in a very particular way: they are filled in row by row by text that was originally in the sheet, in the order that it appeared originally in the sheet. Both originally empty cells and filled cells are overwritten. Thanks in advance for your help. Jim |
#4
| |||
| |||
|
|
On May 10, 3:00 pm, Jim Walsh <JimWa... (AT) discussions (DOT) microsoft.com wrote: A follow-up to my own posting. I finally got this working. My target Excel worksheet had been created by importing a table from a VFP database. Apparently there was something wrong with that. I tried creating the Excel worksheet directly, creating the same columns that were in the VFP worksheet. This now works without any corruption of the Excel worksheet. I don't know what was wrong with the Excel sheet created by importing from VFP. Any thoughts? Jim "Jim Walsh" wrote: VS2005 C# 2.0 I'm using ADO.NET and the Jet 4.0 OLE DB provider to append a row to an Excel spreadsheet. I have a data table of type System.Data.DataTable, and a table adapter of type System.Data.OleDb.OleDbDataAdapter to fill the data table. These are generated by the VS2005 dataset designer. My connection string, created using the Data Links wizard is Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\FootAnalNovel.xls; Extended Properties="Excel 8.0;HDR=Yes";Persist Security Info=False 1. faAdapter.Fill() to fill the table from the worksheet 2. Create a new empty row for the table. 3. Set values for elements of the row. 4. Add the row to the table. 5. Call faAdapter.Update() to send results back to the spreadsheet In the target spreadsheet I observe: 1. The row was added. The first column was autoincremented as desired. 2. All numeric columns in the sheet, including dates, are correct. 3. The header line has not been modified - that is correct. 4. All text columns in the table have been corrupted. But, in a very particular way: they are filled in row by row by text that was originally in the sheet, in the order that it appeared originally in the sheet. Both originally empty cells and filled cells are overwritten. Thanks in advance for your help. Jim I am dealing with almost the exact same problem right now. I'm not exporting from VFP, but I am experiencing all the other symptoms. I can't seem to figure out what is wrong with the original spreadsheet that would cause this. I've tried a ton of different modes in my connection string, but no luck. I'd be very curious to find out what is causing your issue if you happen to find a root cause. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |