I need to do an update but the column name is dynamic.
Code Snippet:
using (var cn = Connection)
{
var sql = @"UPDATE Teste
SET @columnName = @parameter,
DT_PROCESSAMENTO = @vDtProcessamento
WHERE ID = @ID";
var resultado = cn.Execute(sql, new
{
columnName,
parameter,
ID
});
}
Is it possible to pass the column name as a parameter? This code is what I did, but it does not work. No exceptions but the update does not work.