Which line of code should you insert at line 07?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The application connects to a Microsoft SQL Server 2005 database.

You write the following code segment in the exception handler of the application. (Line numbers are included for reference only.)

01 private string ShowSQLErrors(SqlException ex){
02 StringBuilder sb = new StringBuilder();
03 foreach (SqlError err in ex.Errors) {
04 sb.Append("Message: ");
05 sb.Append(err.Number.ToString());
06 sb.Append(", Level: ");
07
08 sb.Append(", State: ");
09 sb.Append(err.State.ToString());
10 sb.Append(", Source: ");
11 sb.AppendLine(err.Source.ToString());
12 sb.AppendLine(err.Message.ToString());
13 sb.AppendLine();
14 }
15 return sb.ToString();
16 }

You need to ensure that the original severity level of the error is included in the error message for each SQL error that occurs.

Which line of code should you insert at line 07?

You create an application by using the Microsoft .NET Framework 3.5 and Microsoft ADO.NET. The application connects to a Microsoft SQL Server 2005 database.

You write the following code segment in the exception handler of the application. (Line numbers are included for reference only.)

01 private string ShowSQLErrors(SqlException ex){
02 StringBuilder sb = new StringBuilder();
03 foreach (SqlError err in ex.Errors) {
04 sb.Append("Message: ");
05 sb.Append(err.Number.ToString());
06 sb.Append(", Level: ");
07
08 sb.Append(", State: ");
09 sb.Append(err.State.ToString());
10 sb.Append(", Source: ");
11 sb.AppendLine(err.Source.ToString());
12 sb.AppendLine(err.Message.ToString());
13 sb.AppendLine();
14 }
15 return sb.ToString();
16 }

You need to ensure that the original severity level of the error is included in the error message for each SQL error that occurs.

Which line of code should you insert at line 07?

A.
sb.Append(err.ToString());

B.
sb.Append(err.Class.ToString());

C.
sb.Append(err.Procedure.ToString());

D.
sb.Append(err.LineNumber.ToString());



Leave a Reply 0

Your email address will not be published. Required fields are marked *