E
eclipx
I am trying to pull rows from an Excel file into a dataset. The Excel file
is a long list of customer names, addresses, phone numbers, etc. I thought
everything was working great. It looked like the rows had all imported into
the dataset, but then (seemingly at random) certain rows were missing data.
The majority of each row's data is there but zip codes are missing in my
dataset and clearly available in the Excel file. So far is seems that the
zip code column is all that is affected. I haven't taken too close a look at
any other fields. My code for importing Excel file data into a dataset is
listed below. In order to view this data, I set a datagridview's datasource
property to ExcelDataSet.Tables(0). If you need me to send one of the files
I am working with so you can better reproduce this problem, let me know what
email address to send it to. Thanks for any help you can provide. I am
completely stumped by this problem.
Private Sub LoadFile(ByVal worker As BackgroundWorker)
If remExcelFileName > "" Then
If remExcelSheet > "" Then
ExcelDataSet = New DataSet
ExcelDataAdapter = New OleDb.OleDbDataAdapter("SELECT * FROM
[" & remExcelSheet & "]", conn)
Try
ExcelDataAdapter.Fill(ExcelDataSet)
Catch ex As Exception
MsgBox(ex.Message)
Exit Sub
End Try
Else
MsgBox("You must select an Excel Sheet to load. ",
MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Excel Sheet Selection
Required")
End If
Else
MsgBox("You must select an Excel File to load. ",
MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Excel File Selection Required")
End If
End Sub
is a long list of customer names, addresses, phone numbers, etc. I thought
everything was working great. It looked like the rows had all imported into
the dataset, but then (seemingly at random) certain rows were missing data.
The majority of each row's data is there but zip codes are missing in my
dataset and clearly available in the Excel file. So far is seems that the
zip code column is all that is affected. I haven't taken too close a look at
any other fields. My code for importing Excel file data into a dataset is
listed below. In order to view this data, I set a datagridview's datasource
property to ExcelDataSet.Tables(0). If you need me to send one of the files
I am working with so you can better reproduce this problem, let me know what
email address to send it to. Thanks for any help you can provide. I am
completely stumped by this problem.
Private Sub LoadFile(ByVal worker As BackgroundWorker)
If remExcelFileName > "" Then
If remExcelSheet > "" Then
ExcelDataSet = New DataSet
ExcelDataAdapter = New OleDb.OleDbDataAdapter("SELECT * FROM
[" & remExcelSheet & "]", conn)
Try
ExcelDataAdapter.Fill(ExcelDataSet)
Catch ex As Exception
MsgBox(ex.Message)
Exit Sub
End Try
Else
MsgBox("You must select an Excel Sheet to load. ",
MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Excel Sheet Selection
Required")
End If
Else
MsgBox("You must select an Excel File to load. ",
MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Excel File Selection Required")
End If
End Sub