book main | contents |
reviews | updates
|
Correction 1.1 Page 66 (Incorrect project type and beta sample code.) To create the "ADO to XML File" project, follow these steps: 1. Create a new Visual Basic Console Application project with name ADOSample. 2. Double-click on the button and type the following code: Dim strConn As String Dim objConn As SqlConnection Dim objCmd As SqlCommand Dim objDS As New DataSet() Dim objDA As New SqlDataAdapter() strConn = "Initial Catalog = pubs;Data Source = localhost; User ID = sa;password=Enterprise" objConn = New SqlConnection(strConn) objConn.Open() objCmd = New SqlCommand("Select title, price from titles", objConn) objDA.SelectCommand = objCmd objDA.Fill(objDS, "titles") Dim oRow As DataRow For Each oRow In objDS.Tables(0).Rows Console.WriteLine(oRow(0).ToString() & " " & oRow(1).ToString()) Next Console.In.Read() 3. Notice that the project doesn't understand what the SqlConnection, SqlCommand, DataSet or SqlDataAdapter are and indicates this by underlining the code. By placing the mouse over the underlined code, a message displays the message, User-Defined type not defined. 4. Scroll to the top of the code window and type the following: Imports System.Data.SQLClient NOTE: The last line of code Console.In.Read() is only to pause the Console long enough for you to see the results and press [Enter] to exit the application. Correction 1.2 Page 42 (Macro Recorder) The following steps walk you through creating a simple macro with the Macro Recorder. This will be a temporary macro that displays your Task Window: 1. Select Macros from the Tools menu option, and then press Record TemporaryMacro from the Macro menu item. At this point the Macro Recorder is recording every click and action taken within the Visual Studio .NET IDE. 2. Select Other Windows from the View menu option and press Task List. The Macro Recorder recorded the click events just made. 3. Press the stop button on the tool bar. 4. Close the Task List window. 5. To run this temporary macro, select Macros from the Tools menu and press Run TemporaryMacro from the Macro menu item. You'll notice that the Task List window is added to the Visual Studio .NET IDE. Correction 1.3 Page 56-57 (Me and not Form1). 1. Right-click on the Form1.vb object in the Solution Explorer window and select View Code. 2. Under the comment, "'Add any initialization after the InitializeComponent() call" type the following code. You will first need to expand the "Windows Form Designer generated code" region. Add the following code: Me.text = "Hello World" Your screen should look like Figure 3-22. Correction 1.4 Page 57 Running the "Hello World" Application To run your new windows application, select Debug from the menu bar and then select Start or press F5. You have now created a .NET Windows Application. Correction 1.4 Page 60 (change "right" to "left") 2. Select the HelloWorld.aspx file and press the View Designer button in the Solution Explorer window. 3. Drag a Label control from the Toolbox on the far right. Left-click on the label and select Properties. 4. In the Properties Window, type "This is my first ASP .NET application." in the Text property box. You could do more, but more detail will be covered in Chapter 8, "Building Forms." Correction 1.5 Page 62 (ASP.NET Web Service) Here's a simple example of a web service that accepts two numbers and returns their sum: 1. Start Visual Studio .NET 2. From the File menu, select New and then select Project. 3. In the New Project window, select the Visual Basic Projects folder. 4. Select the ASP.NET Web Service project icon. 5. Before clicking OK, you must select the project name and location. Use the following information to populate the Name and Location text boxes: Correction 1.6 Page 63 (Correcting WS code) Public Function Sum_WebService(ByVal a As Integer, ByVal b As Integer) As Integer Sum_WebService = a + b End Function Correction 1.7 Page 79 (Remove Class Browser) The Class Browser application is no longer available. Note should be removed. Correction 1.8 Page 132 (Incorrect Namespace) System.Thread provides clsses for building multi-threaded appliactions. |
book main | contents | reviews | updates
Copyright 2008 by No Starch Press