UPDATE formato numerico su foglio excel

sabato 05 marzo 2011 - 09.21
Tag Elenco Tags  C#  |  .NET 3.5  |  Windows Server 2003  |  Windows XP  |  Visual Studio Express  |  SQL Server 2005  |  SQL Server Express  |  MySQL 5.0  |  Access (.mdb)  |  Office 2007  |  Office 2003  |  Internet Explorer 7.0  |  Javascript  |  XHTML 2.0

secks Profilo | Senior Member

Buongiorno.
In ambiente C# express 3.5 ho connesso un foglio excel con la seguente stringa

cn = new System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source='" + txtFil.Text + "';Extended Properties=Excel 8.0;");


scrivo nel foglio determinati campi come da seguente comando e tutto ok.


s = "UPDATE [cat_mp_003_master_ET$] SET ";
s += "SPACART = '" + Convert.ToString(j[0]["CODPRO"]) + "', ";
s += "SPACCNE = " + Convert.ToString(j[0]["COS3"]).Replace(",", ".") + ", ";
s += "SPACL14 = " + Convert.ToString(j[0]["PRZ14"]).Replace(",", ".") + ", ";
s += "SPACL03 = " + Convert.ToString(j[0]["PRZ03"]).Replace(",", ".") + " ";
s += "WHERE EAN='" + Convert.ToString(y["EAN"]) + "'";

Il problema è che nelle celle con formato numerico viene scritto il valore con un'apice davanti, trasformandolo in stringa.
Come posso fare in modo che con l'UPDATE dei campi numerici non vengano trasformati in stringa nel foglio excel ma mantenuti come valori numerici?

Saluti e grazie.
Paolo.

Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5