Hi All,
I could achieve the same thing using below help.
Now, facing another problem like the excel data with numeric or datetime
data comes in datagrid along with the same formatting applied.
So the header for numeric columns(e.g. Price/Quantity) does not show in grid.
Can anyone suggest any soln on this?
Thanks in advance.
"Frans Vander Meiren" wrote:
> Thanks a lot, Paul. I''ll try it
>
> Frans
>
> "Paul Clement" wrote:
>
> > On Wed, 23 Jun 2004 13:02:01 -0700, "Frans Vander Meiren" <Frans Vander
> > Meiren@discussions.microsoft.com> wrote:
> >
> > ¤ Hi
> > ¤
> > ¤ Anyone who can explain me how to load and edit an Excel-file in a DataGrid via an odbcConnection?
> > ¤ Thanks
> >
> > The following should get you started:
> >
> > ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> > "Data Source=e:\My Documents\Book20.xls;Extended Properties=""Excel 8.0;HDR=NO"""
> >
> > Dim ExcelConnection As New System.Data.OleDb.OleDbConnection(ConnectionString)
> > ExcelConnection.Open()
> >
> > Dim da As New System.Data.OleDb.OleDbDataAdapter("Select * from [Sheet8$]", ExcelConnection)
> >
> > Dim ds As New DataSet("Workbooks")
> >
> > da.Fill(ds, "Sheet8")
> >
> > DataGrid1.SetDataBinding(ds, "Sheet8")
> >
> >
> > Paul ~~~ pclement@ameritech.net
> > Microsoft MVP (Visual Basic)
> >