B
Brian Hanson
Hi,
I have an unusual problem that just showed its ugly head at a pretty
bad time. I have an asp.net (VB) app that takes data from an Excel
sheet and puts it into SQL Server. I get the data out of Excel using
OleDB, and suddenly, some of the data was not being extracted from
Excel.
I use OleDb for the extract into a DataTable and from there an
SqlClient.SqlCommand to put it into SQL Server.
I put the results of the OleDb extract into a datagrid to see if the
problem was there or the SqlClient insert. The datagrid showed
missing data, even before I got to the SQL insert. Here's my code
(roughly):
Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;"
_
& "Data Source = " test.xls" _
& ";" & "Extended Properties=Excel 8.0;"
Dim objConnXL As New OleDbConnection(sConnectionString)
''''Create Data Adapter and Data Set.
Dim Employee Select As New OleDbCommand("SELECT * FROM
Employee where RowNum > 0 ", objConnXL)
Dim Employee Adapter As New OleDbDataAdapter()
Employee Adapter.SelectCommand = Employee Select
Dim Employee Dataset As New DataSet()
Employee Adapter.Fill(Employee Dataset, "XLData")
'DataGrid1.DataSource = Employee Dataset.Tables(0).DefaultView
'DataGrid1.DataBind()
Assume the following data from an Excel namespace called Employee:
First Last Addr City State Zip RowNum
Joe Smith 123 Main NY NY 12345 1
Bill Jones 456 North LA CA 54321 2
The extract suddenly omitted the zip 12345, but displayed the other 13
pieces of data fine. I can see the data in the Excel sheet. This has
been working fine for several months, and of course, last week we went
live, go figure.
If anyone has run into this or anything like it, please give a yell.
Thanks.
I have an unusual problem that just showed its ugly head at a pretty
bad time. I have an asp.net (VB) app that takes data from an Excel
sheet and puts it into SQL Server. I get the data out of Excel using
OleDB, and suddenly, some of the data was not being extracted from
Excel.
I use OleDb for the extract into a DataTable and from there an
SqlClient.SqlCommand to put it into SQL Server.
I put the results of the OleDb extract into a datagrid to see if the
problem was there or the SqlClient insert. The datagrid showed
missing data, even before I got to the SQL insert. Here's my code
(roughly):
Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;"
_
& "Data Source = " test.xls" _
& ";" & "Extended Properties=Excel 8.0;"
Dim objConnXL As New OleDbConnection(sConnectionString)
''''Create Data Adapter and Data Set.
Dim Employee Select As New OleDbCommand("SELECT * FROM
Employee where RowNum > 0 ", objConnXL)
Dim Employee Adapter As New OleDbDataAdapter()
Employee Adapter.SelectCommand = Employee Select
Dim Employee Dataset As New DataSet()
Employee Adapter.Fill(Employee Dataset, "XLData")
'DataGrid1.DataSource = Employee Dataset.Tables(0).DefaultView
'DataGrid1.DataBind()
Assume the following data from an Excel namespace called Employee:
First Last Addr City State Zip RowNum
Joe Smith 123 Main NY NY 12345 1
Bill Jones 456 North LA CA 54321 2
The extract suddenly omitted the zip 12345, but displayed the other 13
pieces of data fine. I can see the data in the Excel sheet. This has
been working fine for several months, and of course, last week we went
live, go figure.
If anyone has run into this or anything like it, please give a yell.
Thanks.