Hello Team ,
I imported excel data to gridview successfully, but i need the excel rowheader as gridview rowheader with out doing a loop, as my excel having more than 60,000 records, looping will be very slow,
my code is
string connectionString = "provider=Microsoft.Jet.OLEDB.4.0;Data Source='"+ System.IO.Path.GetDirectoryName(path) + "';Extended Properties=\"Text;HDR=YES;FMT=Delimited\";";// "//Excel 8.0;";
DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OleDb");
DbDataAdapter adapter = factory.CreateDataAdapter();
DbCommand selectCommand = factory.CreateCommand();
selectCommand.CommandText = "select * from [" + System.IO.Path.GetFileName(path) + "]";
DbConnection connection = factory.CreateConnection();
connection.ConnectionString = connectionString;
selectCommand.Connection = connection;
adapter.SelectCommand = selectCommand;
adapter.Fill(data);
Gridview.DataSource = data.Tables[0];
The above code is importing the all the fields of excel, but i need the excel rowID column
i mean row header, which is the identity column in excel, the first column
can any one helps me