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
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