LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default excel sheet dirty read and dirty write?

Hello,

I use ado.net to write certain cell in an excel sheet and then read
some value back. The read value is calculated based on the written
cell.
I can write to the sheet without any exception thrown, but when I try
to read it back, the value I read is the old one, not the value it
should be (the value should be calculated based on the written value I
provided).

Strange thing is that if I put a break point between read and write,
when my code breaks, I just open the sheet using excel (I can see the
values have been updated) and click save in excel. Then the value I
read will contain correct written values.

So I guess it is some dirty read or dirty write thing.

Can someone help me?

Many Thanks


My code to write and read excel :
DbProviderFactory factory =
DbProviderFactories.GetFactory("System.Data.OleDb" );
FinanceQuoteResponse response=null;
using (DbConnection conn = factory.CreateConnection())
{
conn.ConnectionString = this.ConnString;

using (DbCommand command = conn.CreateCommand())
{
//first update value
StringBuilder sb = new StringBuilder("update
[LP Calculator APR$] set ");
sb.AppendFormat("{0}={1},", "G3",
request.TotalPrice);
sb.AppendFormat("{0}={1},", "E4",
request.Deposit);
sb.AppendFormat("{0}={1},", "G6",
request.FinanceQuoteDetail.DocumentationFee);
sb.AppendFormat("{0}={1},", "G7",
request.FinanceQuoteDetail.Apr);
sb.AppendFormat("{0}={1},", "G11",
request.FinanceQuoteDetail.OptionToPurchaseFee);
sb.AppendFormat("{0}={1}", "G12",
request.FinanceQuoteDetail.CreditFacilityFee);


command.CommandText = sb.ToString();

conn.Open();
command.ExecuteNonQuery();
//now calculate
command.CommandText = "SELECT * FROM [LP
Calculator APR$E5:E27]";

DbDataAdapter adapter =
factory.CreateDataAdapter();

adapter.SelectCommand = command;

DataSet output = new DataSet();

adapter.Fill(output);
foreach (DataRow row in output.Tables[0].Rows)
{
//FinanceQuoteResponse response=new
FinanceQuoteResponse
}

}



Jerry
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF that participates in circularity always dirty Dean Meyer Excel Programming 0 February 21st 08 04:11 AM
Determine if template file is dirty XP Excel Programming 1 August 14th 07 06:18 PM
Removing Dirty Data From an Imported DOS database Iain Scott[_2_] Excel Programming 2 July 24th 06 05:36 PM
using Dirty Method Giselle[_2_] Excel Programming 15 February 7th 06 01:21 AM
How to tell if a range or cell is dirty Carl Rapson Excel Programming 4 February 20th 04 05:09 PM


All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"