views:

10

answers:

1

Hi I am trying to commit the following value ("HatMark K.K.") to the database but keep getting an exception.

 command.CommandText = "UPDATE tb_Entries Name = @Name WHERE ID = @ID";
 command.CommandType = CommandType.Text;
 command.Parameters.AddWithValue("@ID", bc.ID);
 command.Parameters.AddWithValue("@Name", bc.Name);

Exception:

Database Commit ErrorSystem.Data.SqlClient.SqlException: Incorrect syntax near 'Name'.

If anyone can point out where I am going wrong, I'd much a appreciate it.

+1  A: 

Shouldn't your SQL be:

UPDATE tb_Entries SET Name = @Name WHERE ID = @ID

Noting the "SET" part between the table name and the first column?

I'm far from a SQL guy, but it may just be that simple...

Jon Skeet
Bingo! Duh...I've been staring at that for hours! Thanks
Chin