0
votes

enter image description here

protected void btnUpload_Click(object sender, EventArgs e) {

string query = "SELECT * FROM [Sheet$]";

OleDbConnection conn = new OleDbConnection(ConStr);

if (conn.State == ConnectionState.Closed)

{

conn.Open();

}

OleDbCommand cmd = new OleDbCommand(query, conn);

OleDbDataAdapter da = new OleDbDataAdapter(cmd);

da.Fill(ds);

GridView1.DataSource = ds.Tables[0];

GridView1.DataBind(); }