Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Updating Excel Spreadsheet Through ASP.NET

Reply
Thread Tools

Updating Excel Spreadsheet Through ASP.NET

 
 
smith387 smith387 is offline
Junior Member
Join Date: Jul 2009
Posts: 1
 
      07-28-2009
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 by smith387; 07-28-2009 at 03:16 PM..
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
selling an Excel spreadsheet Jim Microsoft Certification 2 07-25-2011 09:54 PM
Updating JTable Atomically - block data changes while updating. news.rcn.com Java 2 12-10-2007 11:49 AM
Problem with Excel reports ::::Excel 2003 Migration To Excel 2007 =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?= ASP .Net 15 10-24-2007 01:34 PM
Writing to an Excel Spreadsheet FSD Perl 0 02-19-2005 12:49 AM
exporting an excel file from database; making changes to excel file and updating the database by importing it back Luis Esteban Valencia ASP .Net 1 01-12-2005 12:28 AM



Advertisments