Given the query:
db.ExecuteCommand(
"UPDATE ForumUserStats SET Posts += {0} WHERE UserID = {1} AND ForumID = {2}",
-1, post.AuthorID, post.Forum.ID
);
There are various points in the code where it would be better to save the queries into a StringBuilder
and then execute them in one ExecuteCommand
statement.
How can I add a query like above into a string ready to execute at a later date without having a DataContext
available?
Please note, string.format
does not properly paramatise the properties for SQL (eg with DateTime
and strings
).