data transfer from excel to excel
-
public partial class _Default : System.Web.UI.Page { OleDbConnection oo; OleDbDataAdapter adp; DataSet ds; protected void Page_Load(object sender, EventArgs e) { oo = new OleDbConnection(ConfigurationManager.ConnectionStrings["xls"].ConnectionString); adp = new OleDbDataAdapter("select EID from [Sheet1$]", oo); if (!IsPostBack) { ds = new DataSet(); ViewState["ds"] = ds; adp.Fill(ds, "sheet1"); GridView1.DataSource = ds; GridView1.DataBind(); } else { ds = (DataSet)ViewState["ds"]; GridView1.DataSource = ds; } } protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { int pos = e.RowIndex; string name = ((TextBox)GridView1.Rows[pos].Cells[1].Controls[0]).Text; ds.Tables[0].Rows[pos][0] = name; ds.AcceptChanges(); GridView1.EditIndex = -1; GridView1.DataBind(); } protected void Button1_Click(object sender, EventArgs e) { adp = new OleDbDataAdapter("select EID from [Sheet1$]", oo); OleDbCommandBuilder xx = new OleDbCommandBuilder(adp); adp.Update(ds, "sheet1"); } ---------------------------------------------- In the above code, In page_load: Reading from excel. It works fine. Gridview is bind with that. Works fine. update the date in gridview(working in disconnected mode). Row_updating works fine. Now want to transfer the data from disconnected excel to same excel in connected mode (written under button1_click). Data is not getting pdated in connected excel. Why?
-
public partial class _Default : System.Web.UI.Page { OleDbConnection oo; OleDbDataAdapter adp; DataSet ds; protected void Page_Load(object sender, EventArgs e) { oo = new OleDbConnection(ConfigurationManager.ConnectionStrings["xls"].ConnectionString); adp = new OleDbDataAdapter("select EID from [Sheet1$]", oo); if (!IsPostBack) { ds = new DataSet(); ViewState["ds"] = ds; adp.Fill(ds, "sheet1"); GridView1.DataSource = ds; GridView1.DataBind(); } else { ds = (DataSet)ViewState["ds"]; GridView1.DataSource = ds; } } protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { int pos = e.RowIndex; string name = ((TextBox)GridView1.Rows[pos].Cells[1].Controls[0]).Text; ds.Tables[0].Rows[pos][0] = name; ds.AcceptChanges(); GridView1.EditIndex = -1; GridView1.DataBind(); } protected void Button1_Click(object sender, EventArgs e) { adp = new OleDbDataAdapter("select EID from [Sheet1$]", oo); OleDbCommandBuilder xx = new OleDbCommandBuilder(adp); adp.Update(ds, "sheet1"); } ---------------------------------------------- In the above code, In page_load: Reading from excel. It works fine. Gridview is bind with that. Works fine. update the date in gridview(working in disconnected mode). Row_updating works fine. Now want to transfer the data from disconnected excel to same excel in connected mode (written under button1_click). Data is not getting pdated in connected excel. Why?
Why do you want to pass data between excel sheets in a webpage ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Why do you want to pass data between excel sheets in a webpage ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.