I am using SQL Server CE database and C# language. I have a table with a bigint typed column. When I use a foreach loop for inserting some data :
foreach (int alt in lsAltitudes)
{
Query = "INSERT INTO Altitude (DataID, Height) " +
"VALUES (@ID, @Height) ";
using (var SQLCmd = new SqlCeCommand(Query))
{
SQLCmd.Parameters.Add("@ID", DataID);
SQLCmd.Parameters.Add("@Height", alt);
con.CeExecuteNonQuery(SQLCmd);
}
}
Getting an error :
Parameterized query ‘INSERT INTO Altitude (DataID, Height) VALUES (@ID, @Height) ‘ expects a parameter value which was not supplied.
My DataID variable’s type is long by the way. I think it’s somehow about converting bigint and a long value. But I’m not sure.
If I’m not mistaken it should be so