Home All Groups Group Topic Archive Search About

convert Excel to dataset

Author
4 Aug 2006 1:06 PM
karups
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

Author
4 Aug 2006 1:45 PM
eSolTec, Inc. 501(c)(3)
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.
--
Michael Bragg, President
eSolTec, Inc.
a 501(C)(3) organization
MS Authorized MAR
looking for used laptops for developmentally disabled.


Show quoteHide quote
"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
>
>
Author
8 Aug 2006 6:06 AM
karups
eSolTec wrote:
Show quoteHide quote
> 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.
> --
> 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
> >

you are right
As mentioned i changed the registry and got it worked
-karups