hvordan indsætter jeg et C# floating point i en MSSQL tabel?
jeg har følgende kode:public void addElement(int ordre_id, float xCord, float yCord, int pris)
{
handler.doNonQuery("INSERT INTO Elementer (ordre_id,xCord,yCord,pris)" +
"VALUES ("+ordre_id+",'"+xCord+"','"+yCord+"','"+pris+"')");
}
som jeg f.eks. kalder med addElement(1, 20.2F, 3.3F,2)
det producere med single quotes omkring floatværdierne følgende fejl:
Error converting data type varchar to float.
uden singlequotes følgende fejl:
There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
håber nogen har den gyldne løsning, da jeg er lidt tidspresset
