I have a series of method calls that all share similar qualities. The basic layout is
public void CallDataBase()
{
Utility sqlHelper = new Utility();
StringBuilder query = new StringBuilder(200);
query.Append(@"update " + Environment.NewLine);//or insert, select
query.Append(@" table " + Environment.NewLine);
//...
utility.ConnectAndExecuteNonQuery(query);//or query, scalar
}
I'm not a big fan of the StringBuilder
in this case, but it does help readability to have line breaks in the inline SQL.
Stored Procedures are not an option (way too much work to convert, have higher priorities). LINQ and EF are not options. Company is on SQL 2000 and there are no concrete plans to upgrade.