johnaregan
Programmer
- Mar 13, 2001
- 87
Hi
I am trying to insert into Northwind using bound paramters, the command returns the SQL Server error:
Line 1: Incorrect syntax near '?'.
Can anybody see what it is that I am doing wrong? I have seen similar code on the web.
I am trying to insert into Northwind using bound paramters, the command returns the SQL Server error:
Line 1: Incorrect syntax near '?'.
Can anybody see what it is that I am doing wrong? I have seen similar code on the web.
Code:
...
comm.CommandType = CommandType.Text;
comm.CommandText = "INSERT INTO Employees (FirstName, LastName) VALUES (?, ?)";
comm.Parameters.Add("FirstName", SqlDbType.NVarChar, 20);
comm.Parameters["FirstName"].Value = "Bob";
comm.Parameters.Add("LastName", SqlDbType.NVarChar, 20);
comm.Parameters["@LastName"].Value = "Bobs";
...