Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel JET connection

Status
Not open for further replies.

SQLScholar

Programmer
Aug 21, 2002
2,127
GB
Hey all

I have this code exert

Code:
            connectionString = "Provider =Microsoft.Jet.OLEDB.4.0; Data Source =""" + Dts.Variables("Filename").Value.ToString + """; Extended Properties =""Excel 8.0;HDR=No;IMEX=0""; "
            conn.ConnectionString = connectionString

            conn.Open()
            cmd.Connection = conn


                cmd.CommandText = "SELECT * from [" + Sheet + "]"
                Reader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
                Try

                    Dim RowNumber As Integer = 1
                    While (Reader.Read)
(bits have been cut out for sanity!)

Now after this while if i do a Reader.item(0) i get data from the second row. If i do Reader.getname(0) i get the header. What i effectively want is the header to be in the dataset. I thought this is what HDR=No would give me.

Help JET SQL is doing my nut

Dan

----------------------------------------

Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind - Dr. Seuss

Computer Science is no more about computers than astronomy is about telescopes - EW Dijkstra
----------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top