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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mahesh ChandRank #1 · 393.3K reputationPosted Feb 17, 2009, 5:04 AM EST
Here:
Anish3 reputationPosted Feb 25, 2009, 1:11 AM EST
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
}
lovely neha44 reputationPosted Mar 3, 2009, 7:58 PM EST