How Can I count excel column name?
<p>I Want to import data from excel to sql,in this operation if a user can add one column extra,how can I check which column is newly added and at the same time in sql table also added the new column with the same column name like excel sheet...</p>

<p>I can Done read the excel column count-like below my coding</p>

<pre><code> protected void btn_upload_Click(object sender, EventArgs e)
    {
        //Add Path to Local system dynamically
        string path = string.Empty;

        path = Server.MapPath("~//files//") + Fup_Excel.PostedFile.FileName;

        Fup_Excel.SaveAs(path);
        //-----------------Execl Connection &amp; Count Part-------------------------------------
        //create Oledb connection for Excel Fetch
        OleDbConnection oconn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 8.0");


        OleDbCommand olcmd = new OleDbCommand("select * from [sheet1$]", oconn);//create command for select excel file

        OleDbDataAdapter adapter = new OleDbDataAdapter();

        adapter.SelectCommand = olcmd;//adap the command

        DataSet ds = new DataSet();//collection of data

        adapter.Fill(ds);//data's are filled to dataset

        string count = ds.Tables[0].Columns.Count.ToString();//taking the Excel sheet column count



    }
</code></pre>

<p>Here after I done take count from sql table also
that code's are</p>

<pre><code> SqlConnection sconn = new SqlConnection(@"Data Source=C07-PC\SQLEXPRESS;Initial Catalog=excel;User ID=sa;Password=**********");
        string asdf = null;
        SqlCommand scmd = new SqlCommand();
        scmd.CommandText = "select count(*) from information_schema.columns where table_name='table_1'";
        scmd.Connection = sconn;
        sconn.Open();
        SqlDataReader sr = null;
        sr = scmd.ExecuteReader();
        while (sr.Read())
        {

              asdf =sr[0].ToString();

        }
</code></pre>

<p>and from here onwords i dont know how to check which column is newly added in excel?then that ssame name i want to insert column in sql table also..</p>
