Is there a Dapper executenonquery? How do I know if my update worked?

asp.net c# dapper

Question

So I have a simple update using Dapper:

  using (var conn = new SqlConnection(myConnectionString))
  {
          conn.Open();
          conn.Execute("UPDATE Orders SET Exported=1 WHERE ManufacturerID=@ManufactuterID AND OrderID=@OrderID",
                      new { ManufacturerID = ManufacturerID, OrderID = OrderID });
          conn.Close();
  }

How do I know that this actually worked? I do not see a way to run ExecuteNonQuery using Dapper?

Accepted Answer

Dapper is just a light wrapper around IDbConnection. Internally Execute will call ExecuteNonQuery and return the value.

See ExecuteCommand.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why