|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
convert Excel to datasetwhen i convert Excel file to dataset using the following code, i find that, some col. such as Col1 ------ 404 403 NOT 222 is converted as col1 ----- 404 403 <null> 222 ..I use this code to convert Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " + "data source='" + SaveLocation + " '; " + "Extended Properties='Excel 8.0;IMEX=1;'") Dim da As New OleDbDataAdapter("select * from [Sheet1$]", cnn) da.TableMappings.Add("Table", "TableCom") Dim ds As New DataSet da.Fill(ds) Please help me in this It appears when you're converting the dataset, it's not all true data. There
are strings that are also in your Excel spreadsheet. The conversion is seeing only numbers and the letters are being seen as null, I think. -- Show quoteHide quoteMichael Bragg, President eSolTec, Inc. a 501(C)(3) organization MS Authorized MAR looking for used laptops for developmentally disabled. "karups" wrote: > Hi > when i convert Excel file to dataset using the following code, i find > that, some col. such as > > Col1 > ------ > 404 > 403 > NOT > 222 > > > is converted as > > col1 > ----- > 404 > 403 > <null> > 222 > > ..I use this code to convert > Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " + > "data source='" + SaveLocation + " '; " + "Extended Properties='Excel > 8.0;IMEX=1;'") > Dim da As New OleDbDataAdapter("select * from > [Sheet1$]", cnn) > da.TableMappings.Add("Table", "TableCom") > Dim ds As New DataSet > da.Fill(ds) > > Please help me in this > > eSolTec wrote:
Show quoteHide quote > It appears when you're converting the dataset, it's not all true data. There you are right> are strings that are also in your Excel spreadsheet. The conversion is seeing > only numbers and the letters are being seen as null, I think. > -- > Michael Bragg, President > eSolTec, Inc. > a 501(C)(3) organization > MS Authorized MAR > looking for used laptops for developmentally disabled. > > > "karups" wrote: > > > Hi > > when i convert Excel file to dataset using the following code, i find > > that, some col. such as > > > > Col1 > > ------ > > 404 > > 403 > > NOT > > 222 > > > > > > is converted as > > > > col1 > > ----- > > 404 > > 403 > > <null> > > 222 > > > > ..I use this code to convert > > Dim cnn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " + > > "data source='" + SaveLocation + " '; " + "Extended Properties='Excel > > 8.0;IMEX=1;'") > > Dim da As New OleDbDataAdapter("select * from > > [Sheet1$]", cnn) > > da.TableMappings.Add("Table", "TableCom") > > Dim ds As New DataSet > > da.Fill(ds) > > > > Please help me in this > > As mentioned i changed the registry and got it worked -karups |
|||||||||||||||||||||||