No value given for one or more required parameters. UPDATE Excel file

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi, I am trying to update data in a row/column in a excel file, but i keep getting this error:
<h2 style="font-family:Verdana; font-weight:normal; font-size:14pt; color:maroon; line-height:normal
No value given for one or more required parameters.
<pre class="prettyprint protected void Button2_Click(object sender, EventArgs e)
{
using (OleDbConnection conn = new OleDbConnection())
{
conn.ConnectionString = (@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\AIRSIGNDMCwwwrootContract.xlsx;Extended Properties=""Excel 12.0 Xml;HDR=NO""");
string sql = string.Format("UPDATE [Sheet1$B5:B5] SET F5=TestValue1");
String TestValue1 = TextBox1.Text;

using (OleDbCommand cmd = new OleDbCommand(sql, conn))
{

try
{
conn.Open();
cmd.ExecuteNonQuery();
}

finally
{
conn.Close();
}
conn.Close();
}
}
}
}
}[/code]
<br/>


View the full article
 
Back
Top