I m reading from Excel Sheet and I would like to know if its possible to rename the active sheet before reading it?
Thanks in advance.
Here is how I read the excel:
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\Book1.xls;Extended Properties='Excel 8.0;HDR=Yes;IMEX=1';"
Dim factory As DbProviderFactory = DbProviderFactories.GetFactory("System.Data.OleDb")
Dim adapter As DbDataAdapter = factory.CreateDataAdapter
Dim selectCommand As DbCommand = factory.CreateCommand
selectCommand.CommandText = "SELECT VENDORNO,VENDORNAME,DEBIT FROM [Sheet1$] where VENDORNO is not null"
Dim connection As DbConnection = factory.CreateConnection
connection.ConnectionString = connectionString
selectCommand.Connection = connection
adapter.SelectCommand = selectCommand
Dim debits As DataSet = New DataSet
View Complete Post