hi frds,
how to view the excel sheet data before save in database in Grid
I have to Import a excel sheet and before save in database wants to view its data into a Grid...plz tell me how can I do this...
ASAP
hi frds,
how to view the excel sheet data before save in database in Grid
I have to Import a excel sheet and before save in database wants to view its data into a Grid...plz tell me how can I do this...
ASAP
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
lovely nehaPosted Mar 4, 2009, 12:58 AM
AnishPosted Feb 25, 2009, 6:11 AM
strConn =
"Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + filename(with full path) + ";" + "Extended Properties=Excel 8.0;"; //Specify the connection string //You must use the $ after the object you reference in the spreadsheetOleDbDataAdapter myCommand =
new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn);DataSet myDataSet =
new DataSet();myCommand.Fill(myDataSet,
"ExcelInfo"); // Fill the datasetGirdView1.DataSource = myDataSet.Tables["ExcelInfo"].DefaultView; //set gridview datasource
GridView1.DataBind(); //bind gridview
foreach (DataRow dr in myDataSet.Tables[0].Rows) // loop through the dataset.datatable
{
loop through the DataTable and fill the Database
}
Mahesh ChandPosted Feb 17, 2009, 10:04 AM
Here: