I’m trying to perform update operation on winform using connected ado.net layer.
here’s the code
string insertCmdStr = "UPDATE ARTICLE(SecondId,Group,Code,Name) WHERE (ID=@P1)"; insertCmdStr += "VALUES(@Idd,@group,@code,@name)"; FbCommand cmd = new FbCommand(insertCmdStr, fbConn, tran); cmd.Parameters.AddWithValue("@P1", id); cmd.Parameters.AddWithValue("@Idd", idd); cmd.Parameters.AddWithValue("@group", group); cmd.Parameters.AddWithValue("@code", code); cmd.Parameters.AddWithValue("@name", name); cmd.ExecuteNonQuery();
using this query I’m getting exception
- $exception {“Dynamic SQL ErrorrnSQL error code = -104rnToken unknown – line 1, column 15rn(“} System.Exception {FirebirdSql.Data.FirebirdClient.FbException}
Advertisement
Answer
Should not query be like this:
UPDATE ARTICLE SET SecondId = @Idd, Group = @group, Code = @code, Name = @name WHERE ID = @P1