Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. data transfer from excel to excel

data transfer from excel to excel

Scheduled Pinned Locked Moved ASP.NET
designquestionannouncement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amittinku
    wrote on last edited by
    #1

    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?

    C 1 Reply Last reply
    0
    • A amittinku

      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?

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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.

      A 1 Reply Last reply
      0
      • C Christian Graus

        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.

        A Offline
        A Offline
        amittinku
        wrote on last edited by
        #3

        Requirement is to map a excel sheet data to gridview in ASP.NET. Make changes to excel using gridview in disconnected mode. After that, transfer the chnages to same excel in connected mode.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups