I am trying to update TableA with the below query and it gives me an error "IBM.Data.DB2.iSeries.iDB2SQLErrorException: 'SQL0104 Token CNUM was not valid. Valid tokens: USE SKIP WAIT WITH FETCH LIMIT ORDER WHERE OFFSET". Though i am able to update the database with the same query in DB2.
using (IDbCommand command = this.connection.CreateCommand())
{
command.CommandText = string.Format(
@"UPDATE {0}.TableA
SET
STS = @Status,
USR = @User
WHERE
CNUM = @CNum", CoreServer.CoreCollection);
IDbDataParameter statusParam = CoreServer.CreateParameter(command, "@Status", string.Empty, 3);
IDbDataParameter UserParam = CoreServer.CreateParameter(command, "@User", string.Empty, 50);
IDbDataParameter cNumberParam = CoreServer.CreateParameter(command, "@CNum", string.Empty, 30);
statusParam.Value = CoreServer.ConvertToDatabase(input.Status);
UserParam.Value = input.User == null ? null : input.User.Trim();
cNumberParam.Value = input.CNumber.Trim();
iDB2Command db2Command = (iDB2Command)command;
db2Command.Transaction = (iDB2Transaction)transaction;
db2Command.ExecuteNonQuery();
}
Other Insert and Select queries works fine for the same table
I got this error when I did a copy/paste of the sql where some sort of non-printable character was present.
To narrow down the problem I: