I would like to update a record based on Id parameter, I have tried following step but that does not seem correct way to do because it generates compilation error:
public async Task CustomerUpdateAsync(string customerId)
{
await using var sqlConnection = new SqlConnection(_connectionString);
{
var sqlQuery = "UPDATE Customer(CustomerId,Name,Address,PostalCode,City)" +
"SET (@CustomerId,@Name,@Address,@PostalCode,@City)" +
$"WHERE CustomerId=@CustomerId", new {CustomerId = customerId};
await sqlConnection.ExecuteAsync(sqlQuery, customerId);
}
}
Error:
only assignment call increment decrement await and new object expressions can be used as a statement