I Have a strange problem with SQLServerCe on compact framework Following is my code
Using cmd As SqlServerCe.SqlCeCommand = New SqlServerCe.SqlCeCommand("INSERT INTO Employee (EmployeeName,EmployeeCode) Values (?,?)", cn)
cmd.Parameters.Add("@EmployeeName", "Sachin")
cmd.Parameters.Add("@EmployeeCode", "1001")
mReturn = cmd.ExecuteNonQuery
End Using
When checked in database I found that It was inserting 1001 in employeename and Sachin in employee code.
On further investigation an working with table with more fields I found that in spite of giving (EmployeeName,EmployeeCode) Values (?,?) it inserts data in table as per the ordinal position of the fields. I.e if empcode is first field the first parameter added goes in employee code.
What am I missing?