单项选择题
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. You have completed the following code segment. (Line numbers are for reference only.)
01 public IDataReader GetCustomerReader()
02 {
03 SqlConnection con = new SqlConnection();
04 //Set up the connection
05 con.Open();
06 string sql = "Select * from Customers";
07 IDataReader rd = null;
08
09 con.Close();
10 return rd;
11 }
You need to make sure that a DataReader stream for the data in the Customers table can be
returned from the GetCustomerReader method.
What should you do? ()
A.A
B.B
C.C
D.D
相关考题
-
单项选择题
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. You application has a DataTable named CustActions, which has the following structure as seen in the exhibit. Your application contains the following code. (Line numbers are included for reference only.) 01 DataColumn AccountSuspendedColumn = new DataColumn(); 02 AccountSuspendedColumn.DataType = typeof(Boolean); 03 AccountSuspendedColumn.ColumnName = "AccountSuspended"; 04 CustActions.Columns.Add(AccountSuspendedColumn); You want to make sure that the values in the AccountSuspendedColumn column are set to True, with the following conditions: 1. The value contained in the LatePaymentsCount column is greater than 10. 2. The value contained in the OverrideCode column is equal to "EXEMPT". What should you do?()
A.A
B.B
C.C
D.D -
多项选择题
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application that will connect to the Microsoft SQL Server 2005 database. You then define the connection string of the application as follows: "Server=Prod;Database=WingtipToys;Integrated Security=SSPI;Asynchronous Processing=true" The following code segment is used on the application: (Line numbers are included for reference only.) 01 protected void UpdateData(SqlCommand cmd) { 02 cmd.Connection.Open(); 03 04 lblResult.Text = "Updating ..."; 05 } You discover that the cmd object takes a long time to execute. You want to make sure that the application continues to execute while cmd is executing. What should you do?()
A.A
B.B
C.C
D.D
E.E
F.F
G.G -
单项选择题
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application. The database on the Microsoft SQL Server 2005 database has two tables that are displayed by using two SqlConnection objects in two different GridView controls. You want the tables to be displayed at the same time with the use a single SqlConnection object. What should you do?()
A. Create a bound connection by using the sp_getbindtoken and the sp_bindsession stored procedures.
B. Create an exception handler for the connection-busy exception that is thrown on using a single SqlConnection object.
C. Run the two SqlDataReader objects by using a single SqlCommand object.
D. Enable Multiple Active Result Sets (MARS) in the connection string of the application.
