Append data to the exited data and display in gridview

May 8 2012 4:29 AM
public static DataTable GetDataColumnExcel(string filename, string colomnname,string Table)
        {
            System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0; Data Source = " + filename + "; Extended Properties = \"Excel 8.0;HDR=Yes;IMEX=1\";");
            conn.Open();
          
            string strQuery = "SELECT [" + colomnname + "] FROM [" + Table + "]";
           

            System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter(strQuery, conn);
            System.Data.DataSet ds = new System.Data.DataSet();
            adapter.Fill(ds);
            return ds.Tables[0];
        }
dataGridView1.DataSource = dt1.DefaultView;



here the query gets the data from the excel sheet table. now i want to edit rows in particular column in that table and display to gridview. Please help me

Answers (4)