I update Excel file with Decimal Value using OLE DB worked fine in asp.net.
but when i open that excel file, i found that unnecessary apostrophe added with that decimal value.
so i am not able to get accurate value in that excel file.
if any one have answer then please give me.
Loading
Dhaivat ShahPosted Oct 29, 2010, 12:19 AM
decimal decValue = 5.25;
OleDbCommand objCmdinsert;
string strDestinationConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data Source=c:\Test.xls;" +
@"Extended Properties=" + Convert.ToChar(34).ToString() +
@"Excel 8.0;Imex=2;HDR=NO;" + Convert.ToChar(34).ToString();
OleDbConnection objDestination = new OleDbConnection(strDestinationConnectionString);
objDestination.Open();
Updatestring = "Update [sheet1$ F1:F1] set F1=" + decValue;
objCmdinsert = new OleDbCommand(Updatestring, objDestination);
objCmdinsert.ExecuteNonQuery();
Using Above code, Excel file Updated Successfully. But when i open Excel file the decimal value converted into text.
so if any one know the solution then share their knowledge.
Sam HobbsPosted Oct 28, 2010, 5:08 PM