can someone help me finish my c# code InsertTransaction() – Inserts a transactio
ID: 3834015 • Letter: C
Question
can someone help me finish my c# code
InsertTransaction() – Inserts a transaction into the DB. This insert inserts data about an insert or
a delete, including data affected and a timestamp. The GetGetDateTimeString() gets a
formatted string ready to be inserted into the table without additional formatting in the SQL
string.
// Insert a transaction for audit trail
public static int InsertTransaction(string userName, int qtyChange, Part p, string type)
{
// Declare an int to contain a count of records affected by operation
int records = 0;
// Declare and set sql statement string to insert data into the
// tblTransaction table - use GetDateTimeString() for the Date
// Execute insert - set records to count affected
// Return number of records affected
return records;
}
Explanation / Answer
using(TransactionScope tran = new TransactionScope()) { CallAMethodThatDoesSomeWork(); CallAMethodThatDoesSomeMoreWork(); tran.Complete(); }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.