Reference no: EM131761278
Question 1
Discuss the importance of implementing transactions in web applications. Describe the COMMIT, and ROLLBACK command. In the following SaveEmployee function below, add code to insert the first name, last name, and pay rate into the tblEmployee table. In the database the column names are: FirstName, LastName, PayRate. Also, write the code to commit the transaction.
public static bool SaveEmployee(string Database, string FirstName, string LastName, string PayRate)
{
bool recordSaved;
try
{
OleDbTransaction myTransaction = null;
OleDbConnection conn = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" +"Data Source=" +Database);
conn.Open();
OleDbCommand command = conn.CreateCommand();
string strSQL;
myTransaction = conn.BeginTransaction();
command.Transaction = myTransaction;
// Write the code below to insert the first name, last name, and pay rate into the tblEmployee table
_____________________________________________________
// Add your comments here
command.CommandType = CommandType.Text;
command.CommandText = strSQL;
// Add your comments here
command.ExecuteNonQuery();
// Write the code below to commit the transaction
_______________________________________________________
// Add your comments here
conn.Close();
recordSaved = true;
}
catch (Exception ex)
{
myTransaction.Rollback();
recordSaved = false;
}
return recordSaved;
}
HTML EditorKeyboard Shortcuts
12pt
Paragraph
Question 2
Explain Secure Sockets Layer, authentication, and authorization. Discuss advantages of using validation controls and discuss the RequiredFieldValidator and the RegularExpressionValidator in particular.