Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default No... while trying to update to Excel file

Hi,

I already searched old posts, but still confused.
I am a asp.net application and user "everyone" does have write and
read right to the excel file
public static readonly string sConnectionString1 =
"Provider=Microsoft.ACE.OLEDB.12.0;" + "Extended Properties=\"Excel
12.0;HDR=No; IMEX=1\"; Data Source= 1.xlsx";

My code is
DbProviderFactory factory =
DbProviderFactories.GetFactory("System.Data.OleDb" );
using (DbConnection conn = factory.CreateConnection())
{
conn.ConnectionString = this.ConnString;

conn.Open();
using (DbCommand command = conn.CreateCommand())
{
command.CommandText = "SELECT * FROM [HP
Calculator APR$E4:E6]";
//reading is ok
using (DbDataReader dr =
command.ExecuteReader())
{
while (dr.Read())
{
string hello = dr[0].ToString();
}
}


//update fails as well, the exception is:No
value given for one or more required parameters.

StringBuilder sb = new StringBuilder("update [HP
Calculator APR$] set ");
sb.AppendFormat("{0}='{1}'", "G3",
quoteRequest.TotalPrice);

command.CommandText = sb.ToString();
command.ExecuteNonQuery();

}

I am totally confused, can someone help me?

Thanks
Reply
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
can I update an excel file without opening it? dordy52 Excel Discussion (Misc queries) 1 October 19th 09 10:34 PM
i want to update one excel file the other one update automaticaly Basant New Users to Excel 1 December 16th 06 12:50 AM
Update should be done in different excel file venu Excel Worksheet Functions 0 May 5th 06 02:46 PM
Automating excel file update zaw Excel Programming 0 September 29th 03 10:56 PM


All times are GMT +1. The time now is 10:28 AM.

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"