Import Excel data

G

Guest

hi!
I have a a small problem in importing Excell data and displaying it.
It imports all the data except few of the column, which has a formatting
error. I checked the dataset DataType, its String, but still then I am
getting the error for the 1st column for this data

HTS
6203.424016
6203.42.4016
6203.42.4016
6203.42.4017
6203.42.4017
6203.42.4017
6203.42.4017
6203.42.4017


I am using the below code in VB.NET to do the same.

Dim myDataset As New DataSet
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("/ImportsExcel/excelreading/") &
"excel/" & strFileNameOnly & ";" & _
"Extended Properties=Excel 8.0;"

''You must use the $ after the object you reference in the spreadsheet
Dim myData As New OleDbDataAdapter("SELECT HTS FROM [Sheet1$]",
strConn)
myData.TableMappings.Add("Table", "ExcelTest")
myData.Fill(myDataset)

DataGrid1.DataSource = myDataset.Tables(0).DefaultView
DataGrid1.DataBind()

Thanks,
Baren
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top