You are creating a Web Form. You write the following code segment to create a SqlCommand object.Dim conn As SqlConnection = New SqlConnection(connString)conn.Open()Dim cmd As SqlCommand = conn.CreateCommand()cmd.CommandText = "select count(*) from Customers"You need to display the number of customers in the Customers table. Which two code segments can you use to achieve this goal?()
A. Dim customerCount As Object = cmd.ExecuteScalar()lblCompanyName.Text = customerCount.ToString()
B. Dim customerCount As Integer = cmd.ExecuteNonQuery()lblCompanyName.Text = customerCount.ToString()
C. Dim dr As SqlDataReader = cmd.ExecuteReader()dr.Read()lblCompanyName.Text = dr(0).ToString()
D. Dim dr As SqlDataReader = cmd.ExecuteReader()dr.Read()lblCompanyName.Text = dr.ToString()
第1题:
请找出下面这段程序的错误并修正
Public Function getDataFromDB(ByVal strID As String, ByRef tblDT As DataTable) As Integer
Dim connStr As String = _
System.Configuration.ConfigurationSettings.AppSettings("DBConnectionString")
Dim conn As SqlConnection
Dim ds As New DataSet
Dim iRet As Integer = 0
Dim sqlDA As SqlDataAdapter
Dim sqlComm As SqlCommand
Dim sql As String
If IsNothing(strID) Then
strID = String.Empty
End If
strID = strID.Trim
conn = New SqlConnection(connStr)
Try
conn.Open()
sql = "SELECT * FROM WWJB01 WHERE ID LIKE '%" & strID & "%'"
sqlComm = New SqlCommand(sql, conn)
sqlDA = New SqlDataAdapter
sqlDA.SelectCommand = sqlComm
sqlDA.Fill(ds)
If Not IsNothing(ds) Then
If ds.Tables.Count > 1 Then tblDT = ds.Tables(0).Copy
iRet = ds.Tables(0).Rows.Count
End If
End If
Catch ex As Exception
Throw ex
Finally
If Not conn.State = ConnectionState.Closed Then
conn.Close()
conn.Dispose()
End If
End Try
Return iRet
End Function
第2题:
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a page that contains the following code fragment:
第3题:
You are creating a Web Form. You write the following code segment to create a SqlCommand object.Dim conn As SqlConnection = New SqlConnection(connString)conn.Open( )Dim cmd As SqlCommand = conn.CreateCommand( )cmd.CommandText = "select count(*) from Customers"You need to display the number of customers in the Customers table. Which two code segments can you use to achieve this goal?()
第4题:
You are creating an ASP.NET Web site. The site has a master page named Custom.master. The code-behind file for Custom.master contains the following code segment.Partial Public Class Custom Inherits System.Web.UI.MasterPagePublic Property Region As String Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.LoadEnd SubEnd Class You create a new ASP.NET page and specify Custom.master as its master page.You add a Label control named lblRegion to the new page. You need to display the value of the master pages Region property in lblRegion.What should you do? ()
第5题:
You are creating a DataTable. You use the following code segment to create the DataTable. (Line numbers are included for reference only.) 01 Dim dt As New DataTable("Products") 02 dt.Columns.Add(New DataColumn("Price", _ GetType(Decimal))) 03 dt.Columns.Add(New DataColumn("Quantity", _ GetType(Int32))) 04 Dim dc As DataColumn = New DataColumn("Total", _ GetType(Decimal)) 05 dt.Columns.Add(dc) You need to ensure that the Total column is set to the value of the Price column multiplied by the Quantity column when new rows are added or changed. What should you do? ()
第6题:
You are creating a Windows Forms application by using the .NET Framework 3.5.You plan to develop a new control for the application. You need to ensure that the control extends the DataGridView control by allowing the cells to contain multicolored text. What should you do?()
第7题:
You use Microsoft .NET Framework 4 to create a Windows Presentation Foundation (WPF) application. You want to add an audio player that plays .wav or .mp3 files when the user clicks a button. You plan to store the name of the file to a variable named SoundFilePath. You need to ensure that when a user clicks the button, the file provided by SoundFilePath plays. What should you do?()
第8题:
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page that has a GridView control named GridView1. The GridView1 control displays the data from a database named Region and a table named Location. You write the following code segment to populate the GridView1 control: 01 protected void Page_Load(object sender, EventArgs e) 02 { 03 string connstr; 04 05 SqlDependency.Start(connstr); 06 using (SqlConnection connection = 07 new SqlConnection(connstr)) 08 { 09 SqlCommand sqlcmd = new SqlCommand(); 10 DateTime expires = DateTime.Now.AddMinutes(30); 11 SqlCacheDependency dependency = new 12 SqlCacheDependency("Region", "Location"); 13 Response.Cache.SetExpires(expires); 14 Response.Cache.SetValidUntilExpires(true); 15 Response.AddCacheDependency(dependency); 16 ► 17 sqlcmd.Connection = connection; 18 GridView1.DataSource = sqlcmd.ExecuteReader(); 19 GridView1.DataBind(); 20 } 21 } You need to ensure that the proxy servers can cache the content of the GridView1 control. Which code segment should you insert at line 16?()
第9题:
You are creating an ASP.NET Web site. You create a HTTP module named Custom Module, and you register the module in the web.config file.The Custom Module class contains the following code. Public Class Custom Module Implements IHttpModule Dim footerContent As String = Footer Content"Public Sub Dispose() Implements IHttpModule.DisposeEnd SubEnd Class You need to add code to CustomModule to append the footer content to each processed ASP.NET page. Which code segment should you use?()
第10题:
Create a valid
Set the passwordFormat attribute of the configured membership provider to Encrypted.
Ensure that the enablePasswordRetrieval attribute of the configured membership provider is set to False.
Ensure that the enablePasswordRetrieval attribute of the configured membership provider is set to True.
第11题:
Dim customerCount As Object = cmd.ExecuteScalar()lblCompanyName.Text = customerCount.ToString()
Dim customerCount As Integer = cmd.ExecuteNonQuery()lblCompanyName.Text = customerCount.ToString()
Dim dr As SqlDataReader = cmd.ExecuteReader()dr.Read()lblCompanyName.Text = dr(0).ToString()
Dim dr As SqlDataReader = cmd.ExecuteReader()dr.Read()lblCompanyName.Text = dr.ToString()
第12题:
Wizard1.RequireEmail = True
Wizard1.Email = user@address.com
Wizard1.MailDefinition.From = registration@mysite.com
SmtpMail.SmtpServer = mail.contoso.com
第13题:
You are creating a Web Form. You write the following code segment to create a SqlCommand object. SqlConnection conn = new.SqlConnection(connString); conn.Open( ); SqlCommand cmd = conn.CreateCommand( ); cmd.CommandText = “select cont(*) from Customers”; You need to display the number of customers in the Customers table. Which two code segments can you use to achieve this goal? ()
第14题:
You are creating a Windows Forms Application by using the .NET Framework 3.5.You plan to design a new control that will be used on multiple forms in the app.You need to ensure that the control meets the following requirement (1)It retrieves data from a MSSQL Server 2008 database instance. (2)It uses WPF classes to display data. (3)It uses user-customizable actions when the control is first painted on the form. What should you do?()
第15题:
You create a Web Form that allows users to create a new account. You add a CreateUserWizard control by using the following code segment. You need to ensure that the wizard automatically sends an e-mail message to users when they finish creating their accounts. You add a valid
第16题:
You develop a Web application that writes data to a file on a server. You restrict access to the file to specific Windows users. The Web application runs as CONTOSO/ASPNET. You deny anonymous access to the application in IIS. You add the following XML segment in the Web.config file.You need to ensure that the application meets the following requirements:It must impersonate the user when it writes data to the file.It must run as CONTOSO/ASPNET when a user does not access the file. Which two actions should you perform? ()
第17题:
Your Web site processes book orders. One of the application methods contains the following code segment.Dim doc As New XmlDocument( )doc.LoadXml("
第18题:
You create a Web Form. The Web Form allows users to recover their passwords. You add a PasswordRecovery server control by using the following code segment.You need to ensure that the server control generates a new password and sends it by e-mail to the users e?mail address. Which two actions should you perform? ()
第19题:
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?()
第20题:
You create a Web Form. The Web Form allows users to log on to a Web site. You implement the login logic using a Login control named Login1. The membership data for the application is stored in a SQL Express database in the App_Data directory. You need to configure your application so that the membership data is stored in a local Microsoft SQL Server database. You add the following code segment to the Web.config file.
第21题:
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page that has a GridView control named GridView1. The GridView1 control displays the data from a database named Region and a table named Location. You write the following code segment to populate the GridView1 control. (Line numbers are included for reference only.) 01 Protected Sub Page_Load(ByVal sender As Object, _ ByVal e As EventArgs) 02 Dim connstr As String 03 ... 04 SqlDependency.Start(connstr) 05 Using connection As New SqlConnection(connstr) 06 Dim sqlcmd As New SqlCommand() 07 Dim expires As DateTime = DateTime.Now.AddMinutes(30) 08 Dim dependency As SqlCacheDependency = _ 09 New SqlCacheDependency("Region", "Location") 10 Response.Cache.SetExpires(expires) 11 Response.Cache.SetValidUntilExpires(True) 12 Response.AddCacheDependency(dependency) 13 14 sqlcmd.Connection = connection 15 GridView1.DataSource = sqlcmd.ExecuteReader() 16 GridView1.DataBind() 17 End Using 18 End Sub You need to ensure that the proxy servers can cache the content of the GridView1 control. Which code segment should you insert at line 13? () | English | Chinese | Japan | Korean | - 90 - Test Information Co., Ltd. All rights reserved.
第22题:
Create a bound connection by using the sp_getbindtoken and the sp_bindsession stored procedures.
Create an exception handler for the connection-busy exception that is thrown on using a single SqlConnection object.
Run the two SqlDataReader objects by using a single SqlCommand object.
Enable Multiple Active Result Sets (MARS) in the connection string of the application.
第23题:
Add the following code segment after line 05. dc.ExtendedProperties(Total) = Price * Quantity
Add the following code segment after line 05. dc.Expression = Price * Quantity
Write an event handler for the DataTable's TableNewRow event that updates the row's Total.
Write an event handler for the DataTable's ColumnChanged event that updates the row's Total.