Hey all,
I currently have some code to import a spread into a dataset but it is dependant on the name of the sheet ie sheet1$. I would like this import to work on the first sheet of a xls file no matter what the sheet name is. Any ideas?
vb Code:
Private Function GetAllRows(ByRef objCon As OleDb.OleDbConnection) As DataSet Dim results As New DataSet("ExcelRows") Dim com As New OleDb.OleDbCommand("select * from [sheet1$]", objCon) Dim da As New OleDb.OleDbDataAdapter() da.SelectCommand = com da.Fill(results) Return results End Function




Reply With Quote