Hi,
I have code that imports from Excel sheets of a specified format. In one of the columns, most data is numeric, but non-numeric values are also present. The non-numeric values are ignored by import code, for some reason.
The connectionstring looks like this:
Dim FileConnectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & Path & "\" & _
Filename & ";Extended Properties=" & _
"""Excel 12.0;HDR=YES;IMEX=1;"""
The actual import code looks something like:
Dim Factory As DbProviderFactory = _
DbProviderFactories.GetFactory("System.Data.OleDb")
Dim Adapter As DbDataAdapter = Factory.CreateDataAdapter(), _
DataObject As New DataSet
Using Connection As DbConnection = Factory.CreateConnection
Connection.ConnectionString = FileConnectionString
Using Command As DbCommand = Connection.CreateCommand
Command.CommandText = _
"SELECT [Column1], [Column2]" & _
"FROM [Sheet1$]"
Adapter.SelectCommand = Command
Adapter.Fill(DataObject)
...
Please note that I have enabled IMEX = 1 to inform Excel that mixed data will be present. This doesn't seem to help. Any idea what's going on?