0
I tried to execute a command SQL
for Entity Framework
, tried in the following ways:
string cmd = "UPDATE t0071_compra SET t0071_status = 'Enviado' WHERE t0071_id_compra = 4 AND t0020_id_empresa = 1";
context.Database.SqlQuery<string>(cmd);
context.SaveChanges();
string cmd = "UPDATE t0071_compra SET t0071_status = 'Enviado' WHERE t0071_id_compra = 4 AND t0020_id_empresa = 1";
context.Database.ExecuteSqlCommand(cmd);
context.SaveChanges();
but in none of the ways worked, I’m using Mysql, what’s wrong there?
Do you have an error? if it is
UPDATE
is the second way!– novic
has no error, but has no effect
– alessandre martins
alessandre is very strange, have no effect, maybe does not satisfy the condition! check if returns
int rows = context.Database.ExecuteSQLCommand(cmd)
higher than 0, if return it updated something if returned 0 it had no change?– novic