I\'ve been using a parameterized query to insert values into an Oracle table, like so:
var q = \"insert into MyTable(Field1, Field2...) values(:Field1, :Field2..
When you say you checked the parameters do you mean the Parameters
collection on the SqlCommand class? You might be falling foul of this note on the SqlParameter page:
Use caution when you use this overload of the SqlParameter constructor to specify integer parameter values. Because this overload takes a value of type Object, you must convert the integral value to an Object type when the value is zero, as the following C# example demonstrates. Copy
Parameter = new SqlParameter("@pname", Convert.ToInt32(0));
If you do not perform this conversion, the compiler assumes that you are trying to call the SqlParameter (string, SqlDbType) constructor overload.
I'd suggest you use something like
cmd.Parameters.Add(
new SqlParameter("Field1", SqlDbType.Int32) { Value = field1Val });
instead to explicitly set the type.