Updating Excel Spreadsheet Through ASP.NET

Discussion in '.NET' started by smith387, Jul 28, 2009.

  1. smith387

    smith387

    Joined:
    Jul 28, 2009
    Messages:
    1
    Hello Everyone,

    I am encountering quite an unusual sort of problem while updating my Excel spreadsheet from an ASP.NET application. Basically I have an excel worksheet (Sheet1$) that contains contact information. Two columns are totally blank and I want to update all rows in that column with a single value. I am currently using the following code to perform this action...

    Connection String:
    Code:
    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties=\"Excel 8.0;HDR=YES\"";

    Code to Execute Query:


    Code:
     
    OleDbConnection conn = new OleDbConnection(strConn);
    conn.Open();
    
    string sql = "UPDATE [Sheet1$] SET List_Name='" + listName + "' AND Active='" + active + "'";
    
    OleDbCommand cmd = new OleDbCommand(sql, conn);
    cmd.ExecuteNonQuery();
    
    The code itself executes just fine, but when I go back into my excel spreadsheet to see if the data has been updated, all the rows in these columns are still blank. I have attempted to fix this doing the following:

    A. Checked file permissions on the directory and the file itself.
    B. Added some extended properties to the connection string (ReadOnly, Mode=ReadWrite) with no change in results.
    C. Tried updating a single record but the column row still remained blank.
    D. Debugged to make sure the variables listName and active had values (they did)

    If any of you have some insight on this please let me know. Thanks in advance.
    Last edited: Jul 28, 2009
    smith387, Jul 28, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken Cox [Microsoft MVP]

    Re: Converting XML spreadsheet to native Excel in ASP.NET

    Ken Cox [Microsoft MVP], Jul 1, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    6,423
    Steven Cheng[MSFT]
    Jul 2, 2004
  2. Uma Muthu

    Import an excel spreadsheet in ASP.NET

    Uma Muthu, Apr 7, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    4,654
    Uma Muthu
    Apr 10, 2006
  3. =?Utf-8?B?bGFuZW0=?=
    Replies:
    0
    Views:
    551
    =?Utf-8?B?bGFuZW0=?=
    May 26, 2006
  4. Robert Smith

    opening up an excel spreadsheet in asp.net

    Robert Smith, Apr 23, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    968
    Ross Culver
    Apr 23, 2008
  5. John Straumann

    Create and open Excel spreadsheet from ASP.NET

    John Straumann, Nov 10, 2009, in forum: ASP .Net
    Replies:
    2
    Views:
    1,956
    Mark Stevens
    Nov 11, 2009
Loading...

Share This Page