Page 322 of 755« First...102030...320321322323324...330340350...Last »

How To Read and Write BLOB Data by Using ADO.NET with Visual Basic .NET

The GetChunk and the AppendChunk methods are not available in ADO.NET to read and write binary
large object (BLOB) fields. This article describes how to use the FileStream object and a byte array to read and to write BLOB data from
Microsoft SQL Server to a file.

Requirements

The following list outlines the recommended hardware, software,
network infrastructure, and service packs that are required:

  • Microsoft Windows 2000 Professional, Windows 2000 Server,
    Windows 2000 Advanced Server, or Windows NT 4.0 Server
  • Microsoft Visual Studio .NET
  • Microsoft SQL Server

Create the Project

  1. Add a table named MyImages to your SQL Server Northwind database. Include the following fields in your table:

    • Identity field that is named “ID” of type Int.
    • Field that is named “Description” of type VarChar with a length of 50.
    • Field that is named “ImgField” of type Image.

  2. Start Visual Studio .NET, and then create a new Visual
    Basic Windows Application project.
  3. Add two Button controls to the default form, Form1.
  4. In the Properties window, change the Text property of Button1 to Save to Database (from File), and then
    change the Text property of Button2 to Save to File (from
    Database)
    .
  5. Add the following code to the top of the Code window:
          Imports System.Data.SqlClient
          Imports System.IO
    					

  6. Double-click Button1, and then add the following code to the Button1_Click event handler:
    Note You must change uid and pwd = password> to the correct values before you run this code. Make sure that
    User ID has the appropriate permissions to perform this operation on the
    database.
          Dim con As New SqlConnection _
           ("Server=YourServer;uid=;pwd=;database=northwind")
          Dim da As New SqlDataAdapter _
           ("Select * From MyImages", con)
          Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)
          Dim ds As New DataSet()
    
          da.MissingSchemaAction = MissingSchemaAction.AddWithKey
    
          Dim fs As New FileStream _
           ("C:winntGone Fishing.BMP", FileMode.OpenOrCreate, _
            FileAccess.Read)
          Dim MyData(fs.Length) As Byte
          fs.Read(MyData, 0, fs.Length)
          fs.Close()
          con.Open()
          da.Fill(ds, "MyImages")
          Dim myRow As DataRow
          myRow = ds.Tables("MyImages").NewRow()
    
          myRow("Description") = "This would be description text"
          myRow("imgField") = MyData
          ds.Tables("MyImages").Rows.Add(myRow)
          da.Update(ds, "MyImages")
    
          fs = Nothing
          MyCB = Nothing
          ds = Nothing
          da = Nothing
    
          con.Close()
          con = Nothing
          MsgBox ("Image saved to database")
    					

  7. Double-click Button2, and then add the following code to the Button2_Click event handler:
    Note You must change uid and pwd = password> to the correct values before you run this code. Make sure that
    User ID has the appropriate permissions to perform this operation on the
    database.
          Dim con As New SqlConnection _
           ("Server=YourServer;uid=;pwd=;database=northwind")
          Dim da As New SqlDataAdapter _
           ("Select * From MyImages", con)
          Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)
          Dim ds As New DataSet()
    
          con.Open()
          da.Fill(ds, "MyImages")
          Dim myRow As DataRow
          myRow = ds.Tables("MyImages").Rows(0)
    
          Dim MyData() As Byte
          MyData = myRow("imgField")
          Dim K As Long
          K = UBound(MyData)
    
          Dim fs As New FileStream _
           ("C:winntGone Fishing2.BMP", FileMode.OpenOrCreate, _
            FileAccess.Write)
          fs.Write(MyData, 0, K)
          fs.Close()
    
          fs = Nothing
          MyCB = Nothing
          ds = Nothing
          da = Nothing
    
          con.Close()
          con = Nothing
          MsgBox ("Image retrieved")
    					

  8. Press F5 to compile and to run the application.
  9. Click Save to Database (from File) to load
    the image, C:WinNTGone Fishing.bmp, into the SQL Server Image field. After you receive the confirmation message that the image
    has been saved, check your table to verify.
  10. Click Save to File (from Database) to save
    the data from the SQL Server Image field back to a file. Verify that C:WinNTGone Fishing2.bmp now
    exists.

For additional
information about a similar topic in Visual Basic 6.0, click the following
article number to view the article in the Microsoft Knowledge Base:
258038

(http://support.microsoft.com/kb/258038/EN-US/
)

How To Access and Modify SQL Server BLOB Data by Using the ADO Stream Object

Article ID: 308042 – Last Review: October 16, 2012 – Revision: 5.0


Applies to
  • Microsoft ADO.NET 1.1
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Visual Basic .NET 2003 标准版
kbhowtomaster kbio kbsqlclient kbsystemdata KB308042

Read the article:
How To Read and Write BLOB Data by Using ADO.NET with Visual Basic .NET

How To Implement Forms-Based Authentication in Your ASP.NET Application by Using Visual Basic .NET

This article was previously published under Q308157

This article demonstrates how to implement forms-based
authentication by using a database to store the users.

Requirements

The following list outlines the recommended hardware, software,
network infrastructure, and service packs that you need:

  • Microsoft Visual Studio .NET
  • Microsoft SQL Server
  • Microsoft Internet Information Services (IIS) version 5.0
    or later

Create an ASP.NET Application Using Visual Basic .NET

  1. Open Visual Studio .NET.
  2. Create a new ASP.NET Web Application, and specify the name
    and location.

Configure the Security Settings in the Web.config File

This section demonstrates how to add and modify the and configuration sections to configure the ASP.NET application to
use forms-based authentication.

  1. In Solution Explorer, open the Web.config file.
  2. Change the authentication mode to Forms.
  3. Insert the tag, and fill in the appropriate
    attributes. (For more information about these attributes, refer to the MSDN
    documentation or the QuickStart documentation that is listed in the
    REFERENCES section.) Copy the
    following code, and then click Paste as HTML on the Edit menu to paste the code in the section of the file:
    
    
    
    					

  4. Deny access to the anonymous user in the section as follows:
    
    	
    	
    
    					

Create a Sample Database Table to Store Users Details

This section demonstrates how to create a sample database to
store the user name, password, and role for the users. You need the role column
if you want to store user roles in the database and implement role-based
security.

  1. From the Windows Start menu, click Run, and then type notepad to open
    Notepad.
  2. Highlight the following SQL script code, right-click the
    code, and then click Copy. In Notepad, click Paste on the Edit menu to paste the following code:
    if exists (select * from sysobjects where id =
    object_id(N'dbo.Users') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    drop table dbo.Users
    GO
    CREATE TABLE dbo.Users (
    	uname varchar (15) NOT NULL ,
    	Pwd varchar (25) NOT NULL ,
    	userRole varchar (25) NOT NULL ,
    ) ON PRIMARY
    GO
    ALTER TABLE dbo.Users WITH NOCHECK ADD
    	CONSTRAINT PK_Users PRIMARY KEY  NONCLUSTERED
    	(
    		uname
    	)  ON PRIMARY
    GO
    
    INSERT INTO Users values('user1','user1','Manager')
    INSERT INTO Users values('user2','user2','Admin')
    INSERT INTO Users values('user3','user3','User')
    GO
    					

  3. Save the file as Users.sql.
  4. On the Microsoft SQL Server computer, open Users.sql in
    Query Analyzer. From the list of databases, click pubs, and run the script. This creates a sample users table and
    populates the table in the Pubs database to be used with this sample
    application.

Create a Logon.aspx Page

  1. Add a new Web Form to the project named
    Logon.aspx.
  2. Open the Logon.aspx page in the editor, and switch to HTML
    view.
  3. Copy the following code, and use the Paste as HTML option on the Edit menu to insert the code between the
    tags:

    Logon Page

    Email:
    Password:
    Persistent Cookie:

    This Web Form is used to present a logon form to users so that they can
    provide their user name and password to log on to the application.

  4. Switch to Design view, and save the page.

Code the Event Handler So That It Validates the User Credentials

This section presents the code that is placed in the code-behind
page (Logon.aspx.vb).

  1. Open the Logon.aspx.vb file.
  2. Import the required namespaces in the code-behind file:
    Imports System.Data.SqlClient
    Imports System.Web.Security
    					

  3. Create a ValidateUser function to validate the user credentials by looking in the
    database. (Make sure that you change the Connection string to point to your
    database.)
    Private Function ValidateUser(ByVal userName As String, ByVal passWord As String) As Boolean
            Dim conn As SqlConnection
            Dim cmd As SqlCommand
            Dim lookupPassword As String
    
            lookupPassword = Nothing
    
            ' Check for an invalid userName.
            ' userName  must not be set to nothing and must be between one and 15 characters.
            If ((userName Is Nothing)) Then
                System.Diagnostics.Trace.WriteLine("ValidateUser Input validation of userName failed.")
                Return False
            End If
            If ((userName.Length = 0) Or (userName.Length > 15)) Then
                System.Diagnostics.Trace.WriteLine("ValidateUser Input validation of userName failed.")
                Return False
            End If
    
            ' Check for invalid passWord.
            ' passWord must not be set to nothing and must be between one and 25 characters.
            If (passWord Is Nothing) Then
                System.Diagnostics.Trace.WriteLine("ValidateUser Input validation of passWord failed.")
                Return False
            End If
            If ((passWord.Length = 0) Or (passWord.Length > 25)) Then
                System.Diagnostics.Trace.WriteLine("ValidateUser Input validation of passWord failed.")
                Return False
            End If
    
            Try
                ' Consult with your SQL Server administrator for an appropriate connection
                ' string to use to connect to your local SQL Server.
                conn = New SqlConnection("server=localhost;Integrated Security=SSPI;database=pubs")
                conn.Open()
    
                ' Create SqlCommand to select pwd field from the users table given a supplied userName.
                cmd = New SqlCommand("Select pwd from users where uname=@userName", conn)
                cmd.Parameters.Add("@userName", SqlDbType.VarChar, 25)
                cmd.Parameters("@userName").Value = userName
    
                ' Execute command and fetch pwd field into lookupPassword string.
                lookupPassword = cmd.ExecuteScalar()
    
                ' Cleanup command and connection objects.
                cmd.Dispose()
                conn.Dispose()
            Catch ex As Exception
                ' Add error handling here for debugging.
                ' This error message should not be sent back to the caller.
                System.Diagnostics.Trace.WriteLine("ValidateUser Exception " & ex.Message)
            End Try
    
            ' If no password found, return false.
            If (lookupPassword Is Nothing) Then
                ' You could write failed login attempts here to the event log for additional security.
                Return False
            End If
    
            ' Compare lookupPassword and input passWord by using a case-sensitive comparison.
            Return (String.Compare(lookupPassword, passWord, False) = 0)
    
    End Function
    					

  4. You can use one of two methods to generate the forms
    authentication cookie and redirect the user to an appropriate page in the cmdLogin_ServerClick event. Sample code is provided for both scenarios. Use either of
    them according to your requirement.

    • Call the RedirectFromLoginPage method to automatically generate the forms authentication cookie
      and redirect the user to an appropriate page in the cmdLogin_ServerClick event:
      Private Sub cmdLogin_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) _
         Handles cmdLogin.ServerClick
         If ValidateUser(txtUserName.Value,txtUserPass.value) Then
            FormsAuthentication.RedirectFromLoginPage(txtUserName.Value, _
            chkPersistCookie.Checked)
         Else
            Response.Redirect("logon.aspx", True)
         End If
      End Sub
      						

    • Generate the authentication ticket, encrypt it, create
      a cookie, add it to the response, and redirect the user. This gives you more
      control in how you create the cookie. You can also include custom data along
      with the FormsAuthenticationTicket in this case.
      Private Sub cmdLogin_ServerClick(ByVal sender As Object, _
         ByVal e As System.EventArgs) Handles cmdLogin.ServerClick
         If Validateuser(txtUserName.Value,txtUserPass.Value) Then
            Dim tkt As FormsAuthenticationTicket
            Dim cookiestr As String
            Dim ck As HttpCookie
      
            tkt = New FormsAuthenticationTicket(1, txtUserName.Value, DateTime.Now(), _
      dateTime.Now.AddMinutes(30), chkPersistCookie.Checked, "your custom data")
            cookiestr = FormsAuthentication.Encrypt(tkt)
            ck = new HttpCookie(FormsAuthentication.FormsCookieName(), cookiestr)
            if (chkPersistCookie.Checked) then ck.Expires=tkt.Expiration
            ck.Path = FormsAuthentication.FormsCookiePath()
            Response.Cookies.Add(ck)
      
            Dim strRedirect As String
            strRedirect = Request("ReturnURL")
            If strRedirect <> "" Then
               Response.Redirect(strRedirect, True)
            Else
               strRedirect = "default.aspx"
               Response.Redirect(strRedirect, True)
            End If
         Else
            Response.Redirect("logon.aspx", True)
         End If
      End Sub
      						

Create a Default.aspx Page

This section creates a test page to which users are redirected
after they authenticate. If users browse to this page without first logging on
to the application, they are redirected to the logon page.

  1. Rename the existing WebForm1.aspx page as Default.aspx, and
    open it in the editor.
  2. Switch to HTML view, and copy the following code between
    the
    tags:
    
    						

    This button is used to log off the forms authentication
    session.

  3. Switch to Design view, and save the page.
  4. Import the required namespaces in the code-behind file:
    Imports System.Web.Security
    					

  5. Open the code-behind page (Default.aspx.vb), and copy the
    following code in the cmdSignOut_ServerClick event handler:
    Private Sub cmdSignOut_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles cmdSignOut.ServerClick
       FormsAuthentication.SignOut()
       Response.Redirect("logon.aspx", True)
    End Sub
    					

  6. Save and compile the project. You can now use the
    application.

Troubleshooting

  • You may want to store passwords securely in a database. You
    can use the FormsAuthentication class utility function named HashPasswordForStoringInConfigFile to encrypt the passwords before you store them in the database or
    configuration file.
  • You may want to store the SQL connection information in the
    configuration file (Web.config) so that you can easily modify it if
    necessary.
  • You may consider adding code to prevent hackers who try to
    use different combinations of passwords from logging on. For example, you can
    include logic that accepts only two or three logon attempts. If the user cannot
    log on in a certain number of attempts, you may want to set a flag in the
    database to not allow that user to log on until that user re-enables his or her
    account by visiting a different page or by calling your support line. In
    addition, you should add appropriate error handling wherever
    necessary.
  • Because the user is identified based on the authentication
    cookie, you may want to use Secure Sockets Layer (SSL) on this application so
    that no one can retrieve the authentication cookie and any other valuable
    information that is being transmitted.
  • Forms-based authentication requires that your client accept
    or enable cookies on their browser.
  • The timeout parameter of the configuration section controls the interval at which the
    authentication cookie is regenerated. You can choose a value that provides
    better performance and security.
  • Certain intermediary proxies and caches on the Internet may
    cache Web server responses that contain Set-Cookie headers, which are then
    returned to a different user. Because forms-based authentication uses a cookie
    to authenticate users, this can cause users to accidentally (or intentionally)
    impersonate another user by receiving a cookie from an intermediary proxy or
    cache that was not originally intended for them.

For information about implementing simple forms-based
authentication by using the section to store users and passwords, see the following article
in the ASP.NET QuickStart samples: For information about implementing forms-based authentication by
using an Extensible Markup Language (XML) file to store users and passwords,
see the following topic in the .NET Framework Software Development Kit (SDK)
documentation: For more information about ASP.NET Web application security, see
the following article in the .NET Framework SDK documentation: For more information about the System.Web.Security namespace, see the following article in the .NET Framework SDK
documentation: For more information about ASP.NET configuration, see the
following .NET Framework SDK articles: For information on ASP.NET security guidelines, see the following
MSDN white paper:  For more information, see the following books:

Article ID: 308157 – Last Review: October 16, 2012 – Revision: 9.0


Applies to
  • Microsoft ASP.NET 1.1
  • Microsoft ASP.NET 1.0
  • Microsoft Visual Basic .NET 2003 标准版
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft SQL Server 2000 标准版
  • Microsoft SQL Server 7.0 Standard Edition
kbproductlink kbconfig kbhowtomaster kbsecurity kbweb KB308157

Other Support Sites

Community

Get Help Now

Article Translations

More:
How To Implement Forms-Based Authentication in Your ASP.NET Application by Using Visual Basic .NET

How To Call a Parameterized Stored Procedure by Using ADO.NET and Visual Basic .NET

There are several ways to use ADO.NET to call a stored
procedure and to get back return values and return parameters, including:

  • Use a DataSet object to gather the returned rows and to work with these rows in
    addition to the return values and the return parameters.
  • Use a DataReader object to gather the returned rows, to move through these rows,
    and to gather return values and return parameters.
  • Use the ExecuteScalar method to return the value from the first column of the results’
    first row with the return values and the return parameters. This is most useful
    with aggregate functions.
  • Use the ExecuteNonQuery method to return only the return parameters and the return
    values. Any returned rows are discarded. This is most useful for executing
    action queries.

This article demonstrates the last three methods and uses both
the SqlCommand and the OleDbCommand objects. Make sure that you copy only the code for the managed
provider that you are using. If you are not sure which managed provider you
should use, visit the following Microsoft Developer Network Web site: In each of the samples in this article, the parameters are added
to the Parameters collection of the Command object. When you use the SqlCommand object, you do not have add the parameters in any particular
order, but the parameters must have the correct name. When you use the OleDbCommand object, you must add the parameters in the correct order, and you
cannot use the parameters by name.

Use DataReader to Return Rows and Parameters

You can use the DataReader object to return a read-only, forward-only stream of data. The
information that the DataReader contains can come from a stored procedure. This example uses the DataReader object to run a stored procedure that has an input and an output
parameter and then moves through the returned records to view the return
parameters.

  1. Create the following stored procedure on the server that is
    running Microsoft SQL Server:
    Create Procedure TestProcedure
      (
         @au_idIN varchar (11),
         @numTitlesOUT Integer OUTPUT
      )
    As
    
    select A.au_fname, A.au_lname, T.title
    from authors as A join titleauthor as TA on
    A.au_id=TA.au_id
    join titles as T
    on T.title_id=TA.title_id
    where A.au_id=@au_idIN
    set @numTitlesOUT = @@Rowcount
    return (5)
    					

  2. Use the Imports statement on the System and the System.Data namespaces so that you do not have to qualify declarations in
    those namespaces later in your code. You must use the Imports statement prior to any other declarations. Make sure to copy only
    the code for the provider that you have chosen.SQL Client
    Imports System.Data.SqlClient					

    OLE DB Data Provider

    Imports System.Data.OleDb					

  3. Add the following code to the Form_Load event:SQL Client
    Dim PubsConn As SqlConnection = New SqlConnection & _
        ("Data Source=server;integrated security=sspi;" & _
        "initial Catalog=pubs;")
    
    Dim testCMD As SqlCommand = New SqlCommand & _
        ("TestProcedure", PubsConn)
    
    testCMD.CommandType = CommandType.StoredProcedure
    
    Dim RetValue As SqlParameter = testCMD.Parameters.Add & _
        ("RetValue", SqlDbType.Int)
    RetValue.Direction = ParameterDirection.ReturnValue
    Dim auIDIN As SqlParameter = testCMD.Parameters.Add & _
        ("@au_idIN", SqlDbType.VarChar, 11)
    auIDIN.Direction = ParameterDirection.Input
    Dim NumTitles As SqlParameter = testCMD.Parameters.Add & _
        ("@numtitlesout", SqlDbType.Int)
    NumTitles.Direction = ParameterDirection.Output
    
    auIDIN.Value = "213-46-8915"
    PubsConn.Open()
    
    Dim myReader As SqlDataReader = testCMD.ExecuteReader()
    Console.WriteLine("Book Titles for this Author:")
    Do While myReader.Read
        Console.WriteLine("0", myReader.GetString(2))
    Loop
    myReader.Close()
    
    Console.WriteLine("Return Value: " & (RetValue.Value))
    Console.WriteLine("Number of Records: " & (NumTitles.Value))
    					

    OLE DB Data Provider

    Dim PubsConn As OleDbConnection = New OleDbConnection & _
        ("Provider=sqloledb;Data Source=server;" & _
        "integrated security=sspi;initial Catalog=pubs;")
    
    Dim testCMD As OleDbCommand = New OleDbCommand & _
        ("TestProcedure", PubsConn)
    
    testCMD.CommandType = CommandType.StoredProcedure
    
    Dim RetValue As OleDbParameter = testCMD.Parameters.Add & _
        ("RetValue", OleDbType.Integer)
    RetValue.Direction = ParameterDirection.ReturnValue
    Dim auIDIN As OleDbParameter = testCMD.Parameters.Add & _
        ("@au_idIN", OleDbType.VarChar, 11)
    auIDIN.Direction = ParameterDirection.Input
    Dim NumTitles As OleDbParameter = testCMD.Parameters.Add & _
        ("@numtitlesout", OleDbType.Integer)
    NumTitles.Direction = ParameterDirection.Output
    
    auIDIN.Value = "213-46-8915"
    PubsConn.Open()
    
    Dim myReader As OleDbDataReader = testCMD.ExecuteReader()
    Console.WriteLine("Book Titles for this Author:")
    Do While myReader.Read
        Console.WriteLine("0", myReader.GetString(2))
    Loop
    myReader.Close()
    
    Console.WriteLine("Return Value: " & (RetValue.Value))
    Console.WriteLine("Number of Records: " & (NumTitles.Value))
    					

  4. Modify the connection string for the Connection object to point to the server that is running SQL
    Server.
  5. Run the code. Notice that the DataReader retrieves the records and then returns the parameter values. You
    can use the Read method of the DataReader object to move through the returned records.

    The Output
    window displays the titles of two books, the return value of 5, and the output
    parameter, which contains the number of records (2). Notice that you must close
    the DataReader in the code to see the parameter values. Additionally, note that
    you do not have to move through all of the records to see the return parameters
    if the DataReader is closed.

Use the ExecuteScalar Method of the Command Object

You can use the ExecuteScalar method of the Command object to retrieve parameter values. Additionally, ExecuteScalar returns the first column of the first row of the stored
procedure. This is most useful for aggregate functions as in the following
example.

  1. Create the following stored procedure on the server that is
    running SQL Server:
    Create Procedure TestProcedure2
     (
       @au_idIN varchar (11)
      )
    As
    /* set nocount on */
    select count (T.title)
    from authors as A join titleauthor as TA on
    A.au_id=TA.au_id
    join titles as T
    on T.title_id=TA.title_id
    where A.au_id=@au_idIN
    Return(5)
    					

  2. Use the Imports statement on the System and the System.Data namespaces so that you do not have to qualify declarations in
    those namespaces later in your code. You must use the Imports statement prior to any other declarations. Make sure that you
    copy only the code for the provider that you have chosen.SQL Client
    Imports System.Data.SqlClient					

    OLE DB Data Provider

    Imports System.Data.OleDb					

  3. Add the following code to the Form_Load event:SQL Client
    Dim PubsConn As SqlConnection = New SqlConnection & _
        ("Data Source=server;integrated security=sspi;" & _
        "initial Catalog=pubs;")
    
    Dim testCMD As SqlCommand = New SqlCommand & _
        ("TestProcedure2", PubsConn)
    
    testCMD.CommandType = CommandType.StoredProcedure
    
    Dim RetValue As SqlParameter = testCMD.Parameters.Add & _
        ("RetValue", SqlDbType.Int)
    RetValue.Direction = ParameterDirection.ReturnValue
    Dim auIDIN As SqlParameter = testCMD.Parameters.Add & _
        ("@au_idIN", SqlDbType.VarChar, 11)
    auIDIN.Direction = ParameterDirection.Input
    
    auIDIN.Value = "213-46-8915"
    PubsConn.Open()
    
    Dim intCount As Integer = testCMD.ExecuteScalar
    Console.WriteLine(intCount)
    Console.WriteLine("Return Value: " & (RetValue.Value))
    					

    OLE DB Data Provider

    Dim PubsConn As OleDbConnection = New OleDbConnection & _
        ("Provider=SQLOLEDB;Data Source=server;" & _
        "integrated Security=sspi;initial catalog=pubs;")
    
    Dim testCMD As OleDbCommand = New OleDbCommand & _
        ("TestProcedure2", PubsConn)
    
    testCMD.CommandType = CommandType.StoredProcedure
    
    Dim RetVal As OleDbParameter = testCMD.Parameters.Add & _
        ("RetVal", OleDbType.Integer)
    RetVal.Direction = ParameterDirection.ReturnValue
    Dim IdIn As OleDbParameter = testCMD.Parameters.Add & _
        ("@au_idIN", OleDbType.VarChar, 11)
    IdIn.Direction = ParameterDirection.Input
    
    IdIn.Value = "213-46-8915"
    
    PubsConn.Open()
    
    Dim intCount As Integer = testCMD.ExecuteScalar
    
    Console.WriteLine("Number of Rows: " & intCount)
    Console.WriteLine(RetVal.Value)
    					

  4. Modify the connection string for the Connection object to point to the server that is running SQL
    Server.
  5. Run the code. Notice that the ExecuteScalar method of the Command object returns the parameters. ExecuteScalar also returns the value of column 1, row 1 of the returned rowset.
    Thus, the value of intCount is the result of the count function from the stored
    procedure.

Use the ExecuteNonQuery Method of the Command Object

This sample uses the ExecuteNonQuery method to run the query and to return the parameter values. ExecuteNonQuery also returns the number of records that are affected after the
query runs. However, ExecuteNonQuery does not return any rows or columns from the stored
procedure.

The ExecuteNonQuery method is most useful when you use INSERT, UPDATE, or DELETE
statements if you only have to know how many rows are changed. In a stored
procedure in which you are using only a SELECT statement, you receive -1
because no rows are affected by the query.

  1. Create the following stored procedure on the server that is
    running SQL Server:
    Create Procedure TestProcedure3
      (
    	@au_idIN varchar (11),
    	@au_fnam varchar (30)
      )
    
    As
    /* set nocount on */
    Update authors set au_fname = @au_fnam
    where au_id = @au_idin
    return (5)
    					

  2. Use the Imports statement on the System and the System.Data namespaces so that you do not have to qualify declarations in
    those namespaces later in your code. You must use the Imports statement prior to any other declarations. Make sure that you
    copy only the code for the provider that you have chosen.SQL Client
    Imports System.Data.SqlClient					

    OLE DB Data Provider

    Imports System.Data.OleDb					

  3. Add the following code to the Form_Load event:SQL Client
    Dim PubsConn As SqlConnection = New SqlConnection & _
        ("Data Source=server;integrated security=sspi;" & _
        "initial Catalog=pubs;")
    
    Dim testCMD As SqlCommand = New SqlCommand & _
        ("TestProcedure3", PubsConn)
    
    testCMD.CommandType = CommandType.StoredProcedure
    
    Dim RetValue As SqlParameter = testCMD.Parameters.Add & _
        ("RetValue", SqlDbType.Int)
    RetValue.Direction = ParameterDirection.ReturnValue
    Dim auIDIN As SqlParameter = testCMD.Parameters.Add & _
        ("@au_idIN", SqlDbType.VarChar, 11)
    auIDIN.Direction = ParameterDirection.Input
    Dim auFname As SqlParameter = testCMD.Parameters.Add & _
        ("@au_fnam", SqlDbType.VarChar, 30)
    auFname.Direction = ParameterDirection.Input
    
    auIDIN.Value = "213-46-8915"
    auFname.Value = "Marjorie"
    PubsConn.Open()
    
    Dim rvRows As Integer = testCMD.ExecuteNonQuery
    Console.WriteLine(rvRows)
    Console.WriteLine(RetValue.Value)
    					

    OLE DB Data Provider

    Dim PubsConn As OleDbConnection = New OleDbConnection & _
        ("Provider=SQLOLEDB;Data Source=server;" & _
        "integrated Security=sspi;initial catalog=pubs;")
    
    Dim testCMD As OleDbCommand = New OleDbCommand & _
        ("TestProcedure3", PubsConn)
    
    testCMD.CommandType = CommandType.StoredProcedure
    
    Dim RetVal As OleDbParameter = testCMD.Parameters.Add & _
        ("RetVal", OleDbType.Integer)
    RetVal.Direction = ParameterDirection.ReturnValue
    Dim IdIn As OleDbParameter = testCMD.Parameters.Add & _
        ("@au_idIN", OleDbType.VarChar, 11)
    IdIn.Direction = ParameterDirection.Input
    Dim FnameIn As OleDbParameter = testCMD.Parameters.Add & _
        ("@au_fname", OleDbType.VarChar, 30)
    FnameIn.Direction = ParameterDirection.Input
    
    IdIn.Value = "213-46-8915"
    FnameIn.Value = "Marjorie"
    
    PubsConn.Open()
    
    Dim intRowAffected As Integer = testCMD.ExecuteNonQuery
    
    Console.WriteLine("Number of Rows affected: " & intRowAffected)
    Console.WriteLine(RetVal.Value)
    					

  4. Modify the connection string for the Connection object to point to the server that is running SQL
    Server.
  5. Run the code. The Output window displays the number of
    affected rows (intRowAffect) and the value of the return parameter.

For additional information, visit the following MSDN Web
sites: For more information, see the following Microsoft Training &
Certification course:

Article ID: 308049 – Last Review: October 16, 2012 – Revision: 4.0


Applies to
  • Microsoft ADO.NET 1.1
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Visual Basic .NET 2003 标准版
kbhowtomaster kbsqlclient kbstoredproc kbsystemdata KB308049

View original post here:
How To Call a Parameterized Stored Procedure by Using ADO.NET and Visual Basic .NET

How to connect to a database and run a command by using ADO.NET and Visual Basic .NET

This article was previously published under Q301075

This article describes how to use ADO.NET to connect to a
database and to run a command (such as the UPDATE, the INSERT, or the DELETE
command) by using a Visual Basic .NET console application.

Requirements

The following list outlines the recommended hardware, software,
network infrastructure, and service packs that are required:

  • Microsoft Windows XP, Microsoft Windows Server 2003, Microsoft Windows 2000 Professional, Microsoft Windows 2000 Server,
    Microsoft Windows 2000 Advanced Server, or Microsoft Windows NT 4.0 Server
  • Microsoft Visual Studio .NET

This article assumes that you are familiar with the following
topics:

  • Database terminology
  • Structured Query Language (SQL)

How to run a command

Commands are issued against databases to take actions against
data stores and to include any statement that can be issued against a database.
You can use the OleDbCommand or the SqlCommand classes to get a command to your data store, and OleDbCommand can be specific to the data store. This article demonstrates both
the SqlClient class (to connect to a computer that is running Microsoft SQL
Server) and the OleDb class (for any database that has an OLE DB or ODBC driver
available) within ADO.NET. However, the code is generally the same for
both.

With ADO, you can issue commands through the Command, the Connection, or the Recordset object. In ADO.NET, only the Command objects (SqlCommand or OleDbCommand) run commands.

To run a command, follow these steps:

  1. Follow these steps to create a new console application in
    Visual Basic .NET:

    1. Start Visual Studio .NET.
    2. On the File menu, point to New, and then click Project.
    3. In the New Project dialog box, click Visual Basic Projects under Project Types, and then click Console Application under Templates.
  2. Make sure that your project contains a reference to the System.Data namespace, and add a reference if it does not.
  3. Use the Imports statement on the System and System.Data namespaces so that you do not have to qualify declarations in
    those namespaces later in your code. You can also include System.Data.SqlClient or System.Data.OleDb, depending on which one you are using.
    Imports System
    Imports System.Data
    Imports System.Data.SqlClient
    					

  4. Before you can create a connection to a database, you must
    have a connection string. Connection strings contain all of the information
    that you need to establish a database connection, including the server name,
    the database name, the user ID, and the password. For example, the following
    connection string points to a local computer that is running SQL Server with a
    strong password for the
    account:

    For OleDb connections:

    Provider=SQLOLEDB.1;User ID=;Password=;Initial Catalog=pubs;Data Source=(local)
    						

    For SqlClient connections:

    User ID=;Password=;Initial Catalog=pubs;Data Source=(local)
    						

    NOTE: If you need more assistance determining the connection string
    for your database, search for “ConnectionString” in the Microsoft Developer
    Network (MSDN) Library at the following Microsoft Web site:

  5. Visual Studio creates a module and an empty Main() procedure. Declare a string variable, and store the appropriate
    connection string for your database in this procedure:
    Sub Main()
        Dim sConnectionString As String _
            = "User ID=;Password=;Initial Catalog=pubs;Data Source=(local)"
    End Sub
    					

  6. Using this connection string, create a new OleDbConnection or SqlConnection object, and call its Open method to establish a connection to your database:
    Dim objConn As New SqlConnection(sConnectionString)
       objConn.Open()
    					

  7. Create a SqlCommand or OleDbCommand object, and pass in the command that you want to run and the
    connection object that you created in the previous step. The following sample
    code passes in the INSERT statement:
    Dim sSQL As String = "INSERT INTO Employee " & _
      "(emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date)" & _
      "VALUES ('MSD12923F', 'Duncan', 'W', 'Mackenzie', " & _
               "10, 82,'0877','2001-01-01')"
    Dim objCmd As New SqlCommand(sSQL, objConn)
    					

  8. After you create the SqlCommand or the OleDbCommand object, you can call the ExecuteNonQuery method to run the command that it represents. ExecuteNonQuery is designed for commands that do not return any results (such as
    the DELETE, the UPDATE, and the INSERT statements). If the Execute statement runs without throwing an exception (see the following
    code), the command has been executed successfully against the database.
  9. Save your project. On the Debug menu, click Start to run your command against the database.

How to use parameters

When you run commands against a database (such as the UPDATE, the
INSERT, and the DELETE statements or calls to stored procedures), these
commands are frequently parameterized. This allows the command to be created
one time but executed multiple times with different values that are inserted
instead of parameters. Consider the corresponding DELETE statement to the
INSERT statement that is used in the previous section:

Dim sSQL As String = "DELETE FROM Employee WHERE emp_id = @emp_id"
				

The parameter name (“@emp_id”) in this DELETE statement represents a
parameter than you can replace with different values each time you run the
command.

To use parameters with your command, follow these steps:

  1. Create your OleDbConnection or SqlConnection object, as you did in the “How to
    Run a Command
    ” section.
  2. Replace the values with placeholders (for example,
    “@emp_id” or “@fname”) so that your command text uses parameters. See the
    DELETE statement before these steps for an example.
  3. Create your OleDbCommand or SqlCommand object, and pass in the connection object that you created in the
    first step and the command text that contains the parameter
    placeholders.
  4. For each parameter, add a parameter object to the command
    object’s parameters collection. For each parameter, you must specify a name and
    data type.
    objCmd.Parameters.Add("@emp_id", SqlDbType.Char, 9)
    					

  5. Stored procedures can have parameters that return values
    and output parameters. You must also set a value for each input parameter
    before you can run the query:
    objCmd.Parameters.Item("@emp_id").Value = "MSD12923F"
    					

  6. Run the query as follows:
    Try
        objCmd.ExecuteNonQuery()
        Console.WriteLine("Record Deleted")
    Catch e As Exception
        Console.WriteLine(e.ToString)
    End Try
    Console.WriteLine("Record Deleted")
    Console.Read()
    					

Complete code listing

Imports System
Imports System.Data
Imports System.Data.SqlClient

Module Module1
    Sub Main()
        AddRecord()
        RemoveRecord()
        Pause()
    End Sub

    Sub Pause()
        Console.WriteLine("Press Enter To Continue...")
        Console.ReadLine()
    End Sub

    Sub AddRecord()
        Dim sConnectionString As String _
            = "User ID=;Password=;Initial Catalog=pubs;Data Source=(local)"
        Dim objConn As New SqlConnection(sConnectionString)
        objConn.Open()
        Dim sSQL As String = "INSERT INTO Employee " & _
          "(emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date)" & _
          "VALUES ('MSD12923F', 'Duncan', 'W', 'Mackenzie', " & _
                   "10, 82,'0877','2001-01-01')"

        Dim objCmd As New SqlCommand(sSQL, objConn)
        Try
            objCmd.ExecuteNonQuery()
        Catch e As Exception
            Console.WriteLine(e.Message)
        End Try
        Console.WriteLine("Record Added")
    End Sub

    Sub RemoveRecord()
        Dim sConnectionString As String _
            = "User ID=;Password=;Initial Catalog=pubs;Data Source=(local)"
        Dim objConn As New SqlConnection(sConnectionString)
        objConn.Open()
        Dim sSQL As String = "DELETE FROM Employee WHERE emp_id = @emp_id"
        Dim objCmd As New SqlCommand(sSQL, objConn)

        objCmd.Parameters.Add("@emp_id", SqlDbType.Char, 9)
        objCmd.Parameters.Item("@emp_id").Value = "MSD12923F"

        Try
            objCmd.ExecuteNonQuery()
            Console.WriteLine("Record Deleted")
        Catch e As Exception
            Console.WriteLine(e.ToString)
        End Try
        Console.WriteLine("Record Deleted")
        Console.ReadLine()
    End Sub

End Module
				

For more information about how to use ADO.NET, database
commands, and stored procedures, visit the following Microsoft Web sites:

Article ID: 301075 – Last Review: October 15, 2012 – Revision: 5.0


Applies to
  • Microsoft ADO.NET 1.1
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition

Other Support Sites

Community

Get Help Now

Article Translations

Read More:
How to connect to a database and run a command by using ADO.NET and Visual Basic .NET

HOW TO: Return Errors and Warnings from a SQL Server Stored Procedure in ADO.NET

This article describes how to display both SQL Server
errors and warnings in ADO.NET. If you raise an error that has a severity level
of 10 or less, which is a warning, no exception is raised. This warning is not
populated into the SqlErrorCollection. Instead you must hook into the InfoMessage event of the Connection object and handle the message there.

Errors in SQL
stored procedures with a severity level of 11 through 20 throw an error in SQL
that is caught in the SqlErrorCollection. Also note that some errors that have a severity level of 11 or
greater abort the whole stored procedure.

Requirements

The following list outlines the recommended hardware, software,
network infrastructure, and service packs that are required:

  • Microsoft Visual Studio .NET installed on a compatible
    Microsoft Windows operating system
  • A SQL server with the sample Northwind database
    installed

This article assumes that you are familiar with the following
topics:

  • Visual Basic .NET
  • ADO.NET data access

Create the Project and Add the Stored Procedure in SQL Server

The following sample uses a combination of Sev 10 and Sev 11
errors to demonstrate how you can use ADO.NET to display error messages with
different severity levels. This sample also demonstrates how you can use IFELSE logic in combination with RAISERROR to provide error handling in your SQL Stored procedures.

The sample performs a simple search on the Customers table in the
SQL Server Northwind database. If one of the CustomerIDs is not found, a SEV 10
exception is raised. If both of the CustomerIDs are not found, a SEV 11
exception is raised, and the stored procedure aborts. Note that you must add a
handler to hook into the InfoMessage event of the Connection object to display errors that have a severity level of 10 or
less.

  1. Follow these steps to create a new Visual Basic Windows
    Application project:

    1. Start Visual Studio .NET.
    2. On the File menu, point to New, and then click Project.
    3. In the New Project dialog box, click Visual Basic Projects under Project Types, click Windows Application under Templates, and then click OK.
  2. In Server Explorer, configure a new data connection to the
    Northwind sample database on an available SQL Server.
  3. Expand the Northwind database node, right-click stored procedures, and then click the new stored procedure.
  4. In the code window of your stored procedure, paste the
    following stored procedure code:
    CREATE proc GetCustomers
    @CustomerID1 nvarchar (5),
    @CustomerID2 nvarchar (5)
    AS
    DECLARE @err_message nvarchar(255)
    
    --if no customers found return SEV 11 error to abort stored procedure
    IF NOT EXISTS (Select CustomerID from Customers where CustomerID = @CustomerID1 or CustomerID =  @CustomerID2)
    	BEGIN
    	SET @err_message = @CustomerID1 + ' and ' + @CustomerID2 + ' Not found raise sev 11'
    	RAISERROR (@err_message, 11,1)
    	END
    
    --if 1st customerid not found throw SEV 10 exception
    IF EXISTS (Select CustomerID from Customers where CustomerID = @CustomerID1)
    	BEGIN
    	select * from Customers where CustomerID = @CustomerID1
    	END
    ELSE
    	BEGIN
    	SET @err_message = @CustomerID1 + ' not found raise sev 10'
                 RAISERROR (@err_message,10, 1)
    	END
    
    --if 2nd customerid not found throw SEV 10 exception
    IF EXISTS (select * from Customers where CustomerID = @CustomerID2)
    	BEGIN
    	select * from Customers where CustomerID = @CustomerID2
    	END
    ELSE
    	BEGIN
    	SET @err_message = @CustomerID2 +  ' not found raise sev 10'
        	RAISERROR (@err_message,10, 1)
    	END

  5. Close the stored procedure code window, and then click Yes to save the changes.

Add Code to Display Errors and Warnings

  1. In the code window of Form1, or your Visual Basic .NET
    project, add a reference to System.Data.SQLClient by adding the following line to the top of your Form1.vb file:
    Imports System.Data.SqlClient
    					

  2. Drag 2 TextBox controls (TextBox1 and TextBox2) from the toolbox to
    Form1.
  3. Press F4 to change the Text property of TextBox1 to ALFKI.
  4. Press F4 to change the Text property of TextBox2 to ANATR.
  5. Drag a Button control (Button1) from the toolbox to Form1, and then press F4 to
    change the Text property to Search.
  6. Double-click Button1, and then add the following code to the Button1_Click event handler:

    Note You must change the User ID
    value and the password = value to the correct values before you run this
    code. Make sure that User ID has the appropriate permissions to perform this
    operation on the database.

            Try
                Dim cn As New SqlConnection("Server=servername;Database=Northwind;User Id=;Password=")
                AddHandler cn.InfoMessage, AddressOf cn_InfoMessage
    
                cn.Open()
                Dim cmd As New SqlCommand("GetCustomers")
                cmd.CommandType = CommandType.StoredProcedure
                cmd.Connection = cn
    
                cmd.Parameters.Add(New SqlParameter("@CustomerID1", SqlDbType.NVarChar, 5))
                cmd.Parameters.Add(New SqlParameter("@CustomerID2", SqlDbType.NVarChar, 5))
    
                cmd.Parameters("@CustomerID1").Value = TextBox1.Text
                cmd.Parameters("@CustomerID2").Value = TextBox2.Text
    
                Dim myReader As SqlDataReader = cmd.ExecuteReader()
                Dim RecordCount As Integer = 0
    
                'You must check the nextresult method because there is a possiblity that the
                'stored procedure may return multiple resultsets; the NextResult method
                'positions the DataReader at the next result in the resultset if you
                'have multiple results, otherwise it will return false.
                Do
                Do while myreader.read()
                Debug.WriteLine("Found customer ID : " & myReader(0))
                Loop
                Loop While myreader.NextResult()
    
                myReader.Close()
    
            Catch SqlEx As SqlException
                Dim myError As SqlError
                            Debug.WriteLine("Errors Count:" & SqlEx.Errors.Count)
                For Each myError In SqlEx.Errors
                    Debug.WriteLine(myError.Number & " - " & myError.Message)
                Next
            End Try
    					

  7. Modify the connection string to point to the Northwind
    database on your SQL server.
  8. To display errors that have a severity level of 10 or less,
    add the following sub to handle the InfoMessage event:
        Public Sub cn_InfoMessage(ByVal sender As Object, ByVal e As System.Data.SqlClient.SqlInfoMessageEventArgs)
            Debug.WriteLine("info message event: " & e.Message)
        End Sub
    					

  9. Press CTRL+F5 to run the program. Click Button1 and notice in the Output window that you do not see CustomerIDs
    ALFKI and ANATR. To make sure that the Output window is visible, press
    CTRL+ALT+O.

Generate and Handle a SEV 10 Warning

Change the value in TextBox1 from ALFKI to
AAAAA, and then click Button1 to try to select a value that does not exist in the Customers
database. The custom error code in the stored procedure traps this scenario and
raises a SEV 10 exception. You see that a SEV 10 exception is raised and
displayed by using the InfoMessage event of the Connection object. Error messages that have a severity level of 10 or less
are treated as informational messages, and are not returned as errors or in
query results.

Generate and Handle a SEV 11 Exception

In TextBox1 change the value from ALFKI to
AAAAA, and in TextBox2, change the value from ANATR to
AAAAA, and then click Button1. This does not find both values in the Customers database, and
the stored procedure raises a SEV 11 exception. You now see the SEV 11 error in
the SQLErrorCollection with your custom error message.

For
additional information, click the article numbers below to view the articles in
the Microsoft Knowledge Base:
308049

(http://support.microsoft.com/kb/308049/EN-US/
)

HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual Basic .NET

309490

(http://support.microsoft.com/kb/309490/EN-US/
)

HOW TO: Handle Multiple Results by Using the DataReader in Visual Basic .NET

316549

(http://support.microsoft.com/kb/316549/EN-US/
)

HOW TO: Debug Stored Procedures in Visual Studio .NET

321902

(http://support.microsoft.com/kb/321902/EN-US/
)

HOW TO: Call Stored Procedures with Optional Values in ADO.NET

308051

(http://support.microsoft.com/kb/308051/EN-US/
)

PRB: Output Parameters Are Not Returned When You Run an ADO.NET Command in Visual Basic .NET

Article ID: 321903 – Last Review: October 15, 2012 – Revision: 7.0


Applies to
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2003 Professional Edition
  • Microsoft ADO.NET 1.1
kbhowtomaster kbsqlclient kbsystemdata KB321903

View article:
HOW TO: Return Errors and Warnings from a SQL Server Stored Procedure in ADO.NET

How to call SQL Server stored procedures in ASP.NET by using Visual Basic .NET

This article demonstrates how to use ASP.NET and ADO.NET
with Visual Basic .NET to create and to call a Microsoft SQL Server stored
procedure with an input parameter and an output parameter.

The code
sample in this article first checks whether the stored procedure that you will
create exists in the database. If the stored procedure does not exist, the code
creates a stored procedure that takes one parameter to search the Authors table based on the last name and returns the matching rows and
number of rows that are returned in an output parameter.

This article
also demonstrates how to create a Web Form that provides a simple user
interface. The Web Form contains the following items:

  • A text box in which the user types the search
    condition.
  • A DataGrid control that displays the search results.
  • A Label control that displays the number of returned records.
  • A Button control that calls the stored procedure when the button is
    clicked.

Requirements

The following list outlines the recommended hardware, software,
network infrastructure, and service packs that are required:

  • Microsoft SQL Server version 7.0 or later
  • Microsoft Visual Studio .NET
  • Microsoft Visual Basic .NET
  • Permissions to create the stored procedure in the
    database

This article assumes that you are familiar with the following
topics:

  • SQL Server stored procedures

Create an ASP.NET Project and Add Controls

In this section, you create an ASP.NET project and build the
basic user interface. Note that these steps use Microsoft Visual Basic .NET
code. To create the project, follow these steps:

  1. Click Start, point to Programs, point to Microsoft Visual Studio .NET, and then click Microsoft Visual Studio .NET.
  2. On the Visual Studio .NET Start page, click New Project.
  3. In the New Project dialog box, click Visual Basic Projects under Project Types, and then click ASP.NET Web Application under Templates.
  4. In the Name box, type a name for your Web application, and then click OK.
  5. Add the following server controls to the Web Form, and set
    the properties as they are listed in the table:

    Collapse this tableExpand this table

    Control ID Property Text Property
    Label lblLastName Type the Author’s Last Name:
    TextBox txtLastName %
    Button btnGetAuthors Get Authors
    Label lblRowCount (Row Count)

  6. Drag a DataGrid server control from the toolbox to the Web Form, and then set the
    Name property to GrdAuthors.
  7. Right-click the grid, and then click Autoformat.
  8. Click Professional 1 for the scheme, and then click OK.

Create the GetAuthorsByLastName Stored Procedure

Use the following Transact-SQL code to create the
GetAuthorsByLastName stored procedure:

Create Procedure GetAuthorsByLastName1 (@au_lname varchar(40), @RowCount int output)
as 

select * from authors where au_lname like @au_lname; 

/* @@ROWCOUNT returns the number of rows that are affected by the last statement. */
select @RowCount=@@ROWCOUNT
				

This code includes two parameters: @au_lname and @RowCount. The
@au_lname parameter is an input parameter that obtains the search string to
perform a “like” search in the Authors table. The @RowCount parameter is an output parameter that uses
the @@ROWCOUNT variable to obtain the affected rows.

Create and Run the Stored Procedure

To access SQL Server databases, you must import the System.Data.SqlClient namespace, which provides new objects such as the SqlDataReader and the SqlDataAdapter objects. You can use SqlDataReader to read a forward-only stream of rows from a SQL Server database.
DataAdapter represents a set of data commands and a database connection that
you can use to fill the DataSet object and to update a SQL Server database.

ADO.NET
also introduces the DataSet object, which is a memory-resident representation of data that
provides a consistent, relational programming model regardless of the data
source. The code in this section uses all of these objects.

  1. Double-click the Web Form.
  2. Add the following code to the Declaration section of your
    Web Form, which appears at the top of the Code window:
    Imports System.Data
    Imports System.Data.SqlClient
    					

  3. To make sure that the stored procedure exists and to create
    a new stored procedure, use a SqlCommand object with a SqlDataReader object. You can use SqlCommand to run any SQL commands against the database. Then call the ExecuteReader method of SqlCommand to return SqlDataReader, which contains matching rows for your query.

    Add the
    following code in the Page_Load event of the Web Form:

    'Only run this code the first time the page is loaded.
    'The code inside the IF statement is skipped when you resubmit the page.
    If Not IsPostBack Then
        Dim MyConnection As SqlConnection
        Dim MyCommand As SqlCommand
        Dim MyDataReader As SqlDataReader
    
        'Create a Connection object.
        MyConnection = New SqlConnection("server=(local);database=pubs;Trusted_Connection=yes")
    
        'Create a Command object, and then set the connection.
        'The following SQL statements check whether a GetAuthorsByLastName stored procedure
        'already exists.
        MyCommand = New SqlCommand("if object_id('pubs..GetAuthorsByLastName') is not null " + "begin" + " if objectproperty(object_id('pubs..GetAuthorsByLastName'), 'IsProcedure')= 1" + " select object_id('pubs..GetAuthorsByLastName')" + " else" + " return " + "end" + " else" + " return", MyConnection)
    
        With MyCommand
            'Set the command type that you will run.
            .CommandType = CommandType.Text
    
            'Open the connection.
            .Connection.Open()
    
            'Run the SQL statement, and then get the returned rows to the DataReader.
            MyDataReader = .ExecuteReader()
    
            'If any rows are retuned, the stored procedure that you are trying
            'to create already exists. Therefore, try to create the stored procedure
            'only if it does not exist.
            If Not MyDataReader.Read() Then
                .CommandText = "create procedure GetAuthorsByLastName (@au_lname varchar(40), " & _ 
    
                                "@RowCount int output) " & _ 
    
                                " as select * from authors where au_lname like @au_lname; select @RowCount=@@ROWCOUNT"
                MyDataReader.Close()
                .ExecuteNonQuery()
            Else
                MyDataReader.Close()
            End If
    
            .Dispose()  'Dispose of the Command object.
            MyConnection.Close() 'Close the connection.
        End With
    End If
    					

  4. Call the stored procedure in the Click event of the btnGetAuthors button, and then use the SqlDataAdapter object to run your stored procedure. You must create parameters
    for the stored procedure and append it to the Parameters collection of the SqlDataAdapter object.

    Add the following code after the Page_Load event:

    Private Sub btnGetAuthors_Click(ByVal sender As System.Object, _
     ByVal e As System.EventArgs) Handles btnGetAuthors.Click
        Dim DS As DataSet
        Dim MyConnection As SqlConnection
        Dim MyDataAdapter As SqlDataAdapter
    
        'Create a connection to the SQL Server.
        MyConnection = New SqlConnection("server=(local);database=pubs;Trusted_Connection=yes")
    
        'Create a DataAdapter, and then provide the name of the stored procedure.
        MyDataAdapter = New SqlDataAdapter("GetAuthorsByLastName", MyConnection)
    
        'Set the command type as StoredProcedure.
        MyDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
    
        'Create and add a parameter to Parameters collection for the stored procedure.
        MyDataAdapter.SelectCommand.Parameters.Add(New SqlParameter("@au_lname", _
       SqlDbType.VarChar, 40))
    
        'Assign the search value to the parameter.
        MyDataAdapter.SelectCommand.Parameters("@au_lname").Value = Trim(txtLastName.Text)
    
        'Create and add an output parameter to Parameters collection.
        MyDataAdapter.SelectCommand.Parameters.Add(New SqlParameter("@RowCount", _
        SqlDbType.Int, 4))
    
        'Set the direction for the parameter. This parameter returns the Rows returned.
        MyDataAdapter.SelectCommand.Parameters("@RowCount").Direction = ParameterDirection.Output
    
        DS = New DataSet() 'Create a new DataSet to hold the records.
        MyDataAdapter.Fill(DS, "AuthorsByLastName") 'Fill the DataSet with the rows returned.
    
        'Get the number of rows returned, and then assign it to the Label control.
        'lblRowCount.Text = DS.Tables(0).Rows.Count().ToString() & " Rows Found!"
        lblRowCount.Text = MyDataAdapter.SelectCommand.Parameters(1).Value & " Rows Found!"
    
        'Set the data source for the DataGrid as the DataSet that holds the rows.
        Grdauthors.DataSource = DS.Tables("AuthorsByLastName").DefaultView
    
        'Bind the DataSet to the DataGrid.
        'NOTE: If you do not call this method, the DataGrid is not displayed!
        Grdauthors.DataBind()
    
        MyDataAdapter.Dispose() 'Dispose of the DataAdapter.
        MyConnection.Close() 'Close the connection.
    End Sub
    					

  5. In Solution Explorer, right-click the .aspx page, and then
    click Set as Start Page.
  6. Save the project, and then click Start in Visual Studio .NET. Notice that the project is compiled and
    that the default page runs.
  7. Type the author’s last name in the text box, and then click
    Get Author. Notice that the stored procedure is called and that the returned
    rows populate the DataGrid.

    You can provide SQL Server-type search strings such as
    G%, which returns all the authors by last names that
    start with the letter “G.”

Troubleshooting

  • If you cannot connect to the database, make sure that the ConnectionString properly points to the server that is running SQL
    Server.
  • If you can connect to the database, but if you experience
    problems when you try to create the stored procedure, make sure that you have
    the correct permissions to create stored procedures in the database to which
    you are connecting.

For more information, see the following topics in the
Microsoft .NET Framework Software Development Kit (SDK) documentation: For more information, see the following book:
Wyke, R. Allen, and Sultan Rehman and Brad Leupen. XML Programming (Core Reference)

(http://www.microsoft.com/mspress/books/sampchap/4798.aspx)

. Microsoft Press, 2001.

For more information, see the following Microsoft Training &
Certification course: For additional
information about how to perform this task by using Microsoft Active Server
Pages, click the article number below to view the article in the Microsoft
Knowledge Base:

300488

(http://support.microsoft.com/kb/300488/EN-US/
)

How To Run SQL Stored Procedures from an ASP Page

Article ID: 306574 – Last Review: October 15, 2012 – Revision: 7.0


Applies to
  • Microsoft ASP.NET 1.0
  • Microsoft ASP.NET 1.1
  • Microsoft ADO.NET 1.1
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Visual Basic .NET 2003 Standard Edition
kbhowtomaster kbsqlclient kbsystemdata KB306574

Continued here:
How to call SQL Server stored procedures in ASP.NET by using Visual Basic .NET

ASP.NET data binding overview

This article provides an introduction to ASP.NET data
binding.

For additional ASP.NET overviews, see the following
Microsoft Knowledge Base article:

305140

(http://support.microsoft.com/kb/305140/
)

ASP.NET roadmap

With ASP.NET data binding, you can bind any server control
to simple properties, collections, expressions and/or methods. When you use
data binding, you have more flexibility when you use data from a database or
other means.

This article addresses the following data binding
topics:

Data binding essentials

<%# %> Syntax

ASP.NET introduces a new declarative syntax, . This
syntax is the basis for using data binding in an .aspx page. All data binding
expressions must be contained within these characters. The following list
includes examples of simple data binding from multiple sources:

  • Simple property (syntax for a customer):
  • Collection (syntax for an order):
    
    					

  • Expression (syntax for a contact):
    <%# ( customer.First Name + " " + customer.LastName ) %>
    					

  • Method result (syntax for the outstanding balance):
    <%# GetBalance(custID) %>
    					

In the preceding examples, the inline tags
indicate where the information from a specific data source is to be placed in
the .aspx page. The following data binding example uses a TextBox Web server control:


				

For more information about data binding syntax, see the following .NET
Framework Software Development Kit (SDK) documentation:

Page.DataBind() versus Control.DataBind()

After the particular data sources have been determined and set
for the objects on the .aspx page, you must bind the data to these data
sources. You can use the Page.DataBind or the Control.DataBind method to bind the data to the data sources.

Both
methods work similarly. The main difference is that all data sources are bound
to their server controls after the Page.DataBind method is called. No data is rendered to the control until you
explicitly call either the DataBind method of the Web server control or until you invoke the
page-level Page.DataBind method. Typically, Page.DataBind (or DataBind) is called from the Page_Load event.

For more information about the DataBind method, see the following .NET Framework SDK documentation:
Control.DataBind Method
http://msdn.microsoft.com/en-us/library/w5e5992d.aspx

(http://msdn.microsoft.com/en-us/library/w5e5992d.aspx)

Data-bound list controls

The list controls are special Web server controls that can bind
to collections. You can use these controls to display rows of data in a
customized template format. All list controls expose the DataSource and the DataMember properties, which are used to bind to collections.

These controls can bind their DataSource property to any collection that supports the IEnumerable, the ICollection, or the IListSource interface.

Repeater control

The Repeater control is a templated, data-bound list. The Repeater control is “lookless;” that is, it does not have any built-in
layout or styles. Therefore, you must explicitly declare all HTML layout,
formatting, and style tags in the control’s templates.

The following
code samples demonstrate how you can use one list control, the Repeater control, to display data:

NOTE: You must modify the parameters of the connection string as
necessary for your environment.

Visual Basic .NET

<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>





      
         
         <%# DataBinder.Eval(Container.DataItem,"au_id") %>
	 
      
   



				

Visual C# .NET

<%@ Page language="c#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>




<%# DataBinder.Eval(Container.DataItem,"au_id") %>

Visual J# .NET

<%@ Page language="VJ#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

 


<%# DataBinder.Eval(Container.DataItem,"au_id") %>

For more information about the Repeater control, see the following .NET Framework SDK documentation:

DataList control

The DataList class is a feature-rich, templated, data-bound list. You can
modify the templates to customize this control. Unlike the Repeater control, DataList supports directional rendering and can optionally render in an
HTML table at run time.

For more information about the DataList control, see the following .NET Framework SDK documentation:

DataGrid control

The DataGrid control is a fully featured, multicolumn, data-bound grid. To
customize the layout of individual columns in the DataGrid, you can set the column type to “templated” and modify the
column’s templates. The DataGrid control can render without templates, which makes this control
ideal for reporting scenarios. DataGrid also supports selection, editing, deletion, paging, and sorting
by column and button columns.

For more information about the DataGrid control, see the following .NET Framework SDK documentation:

Accessing data

This section describes how to access data from a database and
bind the data to list controls. You can use the DataSet or the DataReader class to obtain data from a database.

DataSet class

A DataSet contains a complete representation of data, including the table
structure, the relationships between tables, and the ordering of the data. DataSet classes are flexible enough to store any kind of information from
a database to an Extensible Markup Language (XML) file. DataSet classes are stateless; that is, you can pass these classes from
client to server without tying up server connection resources. The following
code demonstrates how to use a DataSet to bind data to a control:

NOTE: You must modify the parameters of the connection string as
necessary for your environment.

Visual Basic .NET

Dim cnn As SqlConnection = New SqlConnection("server=(local);" & _
                                             "database=pubs;Integrated Security=SSPI")
Dim cmd As SqlDataAdapter = New SqlDataAdapter("select * from authors", cnn)
Dim ds As DataSet = New DataSet()
cmd.Fill(ds)
MyRepeater.DataSource = ds
MyRepeater.DataBind()
				

Visual C# .NET

SqlConnection cnn = new SqlConnection("server=(local);
                                       database=pubs;Integrated Security=SSPI");
SqlDataAdapter da = new SqlDataAdapter("select * from authors", cnn);
DataSet ds = new DataSet();
da.Fill(ds);
MyRepeater.DataSource = ds;
MyRepeater.DataBind();
				

Visual J# .NET

SqlConnection cnn = new SqlConnection("server=(local);
                                       database=pubs;Integrated Security=SSPI");
SqlDataAdapter da = new SqlDataAdapter("select * from authors", cnn);
DataSet ds = new DataSet();
da.Fill(ds);
MyRepeater.set_DataSource(ds);
MyRepeater.DataBind();
				

For more information about the DataSet class, see the following .NET Framework SDK documentation:

DataReader class

Conversely, if you only need to display (and not change) the data
that is to be rendered, a DataReader class may be a better solution. For example, it is better to use
a DataReader for a DropDownList control because the DataReader is a forward-only data cursor. The following code demonstrates
how to use a SqlDataReader class to bind data to a control:

Visual Basic .NET

Dim cnn As SqlConnection = New SqlConnection("server=(local);" & _
                                             "database=pubs;Integrated Security=SSPI")
Dim cmd As SqlCommand = New SqlCommand("select * from authors", cnn)

cnn.Open()
MyRepeater.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection)
MyRepeater.DataBind()
				

Visual C# .NET

SqlConnection cnn = new SqlConnection("server=(local);
                                       database=pubs;Integrated Security=SSPI");
SqlCommand cmd = new SqlCommand("select * from authors", cnn);

cnn.Open();
MyRepeater.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection);
MyRepeater.DataBind();
				

Visual J# .NET

SqlConnection cnn = new SqlConnection("server=(local);
                                       database=pubs;Integrated Security=SSPI"); 

SqlCommand cmd = new SqlCommand("select * from authors", cnn); 

cnn.Open();
MyRepeater.set_DataSource(cmd.ExecuteReader(CommandBehavior.CloseConnection));
MyRepeater.DataBind();
				

For more information about the SqlDataReader class and data access with ASP.NET, see the following topics in
the .NET Framework SDK documentation:

Binding in list control templates

You can use templates in the list controls to bind and to
customize individual records of a data source. This section includes three
methods to do this.

DataBinder.Eval method

When the data source works with data that is returned from a
database, the data source may contain numerous pieces of information. You can
use the generic DataBinder.Eval method to return data. In the following code sample, the “au_id”
field is returned from the data source of the container object:

<%# DataBinder.Eval(Container.DataItem,"au_id") %>
				

For more information about the DataBinder.Eval method, see the following .NET Framework SDK documentation:

Explicit casting

If you need more control, use explicit casting. An explicit
conversion uses a type conversion keyword. These keywords act as functions, but
the compiler generates the code inline. Therefore, execution is slightly faster
than with a function call. The following code samples use explicit casting:

Visual Basic .NET

' DataTable as the DataSource
<%# CType(Container.DataItem, System.Data.DataRowView)("au_id") %>

' DataReader as the DataSource
<%# CType(Container.DataItem, System.Data.Common.DbDataRecord)("au_id") %>

' DataReader as the DataSource
<%# CType(Container.DataItem, System.Data.Common.DbDataRecord)(0) %>
				

Visual C# .NET

// DataTable as the DataSource
<%# ((System.Data.DataRowView)Container.DataItem)"au_id" %> 

// DataReader as the DataSource
<%# ((System.Data.Common.DbDataRecord)Container.DataItem)"au_id" %>

// DataReader as the DataSource
<%# ((System.Data.Common.DbDataRecord)Container.DataItem)0 %>
				

Visual J# .NET

// DataTable as the DataSource
<%# ((System.Data.DataRowView)Container.DataItem)"au_id" %> 

// DataReader as the DataSource
<%# ((System.Data.Common.DbDataRecord)Container.DataItem)"au_id" %>

// DataReader as the DataSource
<%# ((System.Data.Common.DbDataRecord)Container.DataItem)0 %>
				

Note that the preceding samples use either a DataTable, which is a subset of a DataSet, or DataReader as a data source.

ItemDataBound event

You can also use the ItemDataBound event of the control to bind the data. This event occurs when an
item is data bound to the control. The following HTML code sample defines a Repeater control with an ItemTemplate:


   
      
   

				

The following methods are required in your page:

Visual Basic .NET

public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

   'TODO: Retrieve data from a database,
   'and bind the data to a list control.

End Sub

public Sub rptr_OnItemDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptr.ItemDataBound
   Dim rec As DataRowView
   rec = e.Item.DataItem

   'Make sure that you have the data.
   If Not IsDBNull(rec) Then
      Dim l1 As Label
      l1 = e.Item.FindControl("lblAuthorID")
      l1.Text = rec("au_id").ToString()
   End If
End Sub
				

Visual C# .NET

public void Page_Init(object sender, System.EventArgs e)

   rptr.ItemDataBound += new RepeaterItemEventHandler(rptr_OnItemDataBound);

public void Page_Load(object sender, System.EventArgs e)

   // TODO: Retrieve data from a database,
   // and bind the data to a list control.

public void rptr_OnItemDataBound(object sender, RepeaterItemEventArgs e)

   System.Data.Common.DbDataRecord rec = (System.Data.Common.DbDataRecord)
                                          e.Item.DataItem;
   if(rec!=null) //Make sure that you have the data.

      Label l1 = (Label)e.Item.FindControl("lblAuthorID");
      l1.Text = rec"au_id".ToString();

}
				

Visual J# .NET

public void Page_Init(Object sender, System.EventArgs e)

            rptr.add_ItemDataBound(new RepeaterItemEventHandler(rptr_OnItemDataBound));

private void Page_Load(Object sender, System.EventArgs e)

            // TODO: Retrieve data from a database,
            // and bind the data to a list control.

public void rptr_OnItemDataBound(Object sender, RepeaterItemEventArgs e)

            System.Data.Common.DbDataRecord rec = (System.Data.Common.DbDataRecord)
                                                   e.get_Item().get_DataItem();
            if (rec != null) //Make sure that you have the data.

                        Label l1 = (Label)e.get_Item().FindControl("lblAuthorID");
                        l1.set_Text(((rec.get_Item("au_id")).ToString()));

}
				

See original article:
ASP.NET data binding overview

How To Hand Code an ADO Data Connection in ASP

This step-by-step procedure demonstrates how to hand code
an ActiveX Data Objects (ADO) data connection in an Active Server Pages (ASP)
page.

For the purposes of this article, the sample to follow uses the
Northwind sample database and establishes an ADO connection to both Microsoft
Access and Microsoft SQL Server 7.0 or 2000.

The Connection String

The connection string is simply a set of string values that
contain your database connection information. For example, the following string
points to the Access database:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:MydatabaseNorthwind.mdb
				

where “C:MydatabaseNorthwind.mdb” represents the source path, which
you should modify to reflect the correct path information to the Northwind
database.

The following string points to SQL Server:

Provider=SQLOLEDB;Server=Your_Server_Name;Database=Northwind; & _
UID=your_user_account;PWD=your_password;
				

where you should modify the Server, UID, and PWD parameters to reflect the correct server name, user name, and
password respectively for the database.

Putting the Connection String to Work

This section presents sample code to get a better idea of how
this works.

  1. From the Windows Start menu, point to Programs, point to Accessories, and then click Notepad.
  2. Highlight the following code, right-click the code, and
    then click Copy. In Notepad, click Paste on the Edit menu to paste the following code into Notepad:
    
    
    
    
    
    
    

    ADO Open Method

    Continue reading here:
    How to troubleshoot general printing problems in Windows 2000 when you are using Office products

    Page 322 of 755« First...102030...320321322323324...330340350...Last »

    Recent Comments

      Archives

      Categories

      <% ' Remember to change the path to Northwind.mdb ' to match the location on your system. src = "C:DatabaseNorthwind.mdb" sConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & src ' Uncomment the next two lines and comment the above line to switch between Access and SQL. 'sConnStr = "Provider=SQLOLEDB;Server=Your_Server_Name;Database=Northwind;" & _ '"UID=your_user_account;PWD=your_password;" 'Create and open the Connection object. Set OBJdbConn = Server.CreateObject("ADODB.Connection") OBJdbConn.Open sConnStr SQLQuery = "SELECT * FROM Customers" 'First Recordset RsCustomerList Set RsCustomerList = OBJdbConn.Execute(SQLQuery) %> <% Do While Not RScustomerList.EOF %> <% RScustomerList.MoveNext Loop RScustomerList.Close Set RScustomerList = Nothing OBJdbConn.Close Set OBJdbConn = Nothing %>
      Company Name Contact Name City State/Province
      <%= RSCustomerList("CompanyName")%> <%= RScustomerList("ContactName")%> <%= RScustomerList("City")%> <%= RScustomerList("Region")%>

    • In Notepad, click Save on the File menu. Save the document with the file name Adopage.asp to the
      default Web site on your server, which is typically located at
      C:InetPubWwwroot.
    • To view the page, start your Web browser, and type the HTTP
      location of the page in the Address bar. If you saved the file in the
      above-mentioned location, type http://<servername>/Adopage.asp in the Address bar.
    • Code Explanation

      • In the preceding sample code, note the following code:
        src = "C:DatabaseNorthwind.mdb"
        sConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & src
        ' Uncomment the next two lines and comment the above line to switch between Access and SQL.
        'sConnStr = "Provider=SQLOLEDB;Server=Your_Server_Name;Database=Northwind;" & _
        '"UID=your_user_account;PWD=your_password;"
        						

        This code is currently set to connect to an Access database. To connect
        to a SQL Server database, comment out the line for the Access provider and
        uncomment the SQL Server lines. To comment out a line, insert an apostrophe (‘)
        at the beginning of the line. To uncomment a line, remove the apostrophe from
        the beginning of the line. The revised code appears as follows:

        src = "C:DatabaseNorthwind.mdb"
        'sConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & src
        ' Uncomment the next two lines and comment the above line to switch between Access and SQL.
        sConnStr = "Provider=SQLOLEDB;Server=Your_Server_Name;Database=Northwind;" & _
        "UID=your_user_account;PWD=your_password;"
        					

      • In the following line of code, you actually begin the
        process of creating the ADO connection:
        Set OBJdbConn = Server.CreateObject("ADODB.Connection")
        						

        Then, you execute the Open command and pass your connection string as follows:

      Troubleshooting

      When you use ADO in ASP, make sure that you:

        For more information about Microsoft Data Access Components
      (MDAC) 2.6 Software Development Kit (SDK), see the following Microsoft Web
      site:

      Article ID: 299980 – Last Review: October 12, 2012 – Revision: 4.0


      Applies to
      • Microsoft Active Server Pages 4.0
      kbaspobj kbcodesnippet kbdatabase kbhowto kbhowtomaster kbscript KB299980
      Retired KB Content Disclaimer

      This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered “as is” and will no longer be updated.

      Original post:
      How To Hand Code an ADO Data Connection in ASP

      Windows NT 4.0 and Windows 2000 disaster recovery and backup and restore procedures

      This article contains information resources for Windows NT
      4.0 and Windows 2000 disaster recovery planning and procedures, as well as
      information about Backup and Restore procedures.

      Active Directory Disaster Recovery

      General Server Disaster Recovery

      Disk Management and Backup and Restore Planning

      Other Knowledge Base Articles

      130928

      (http://support.microsoft.com/kb/130928/
      )

      Restoring a backup of Windows NT to another computer

      139822

      (http://support.microsoft.com/kb/139822/
      )

      How to restore a backup to computer with different hardware

      176014

      (http://support.microsoft.com/kb/176014/
      )

      8.3 short file names not retained after tape restore

      201068

      (http://support.microsoft.com/kb/201068/
      )

      How to set up disaster recovery for a critical WINS Server

      243204

      (http://support.microsoft.com/kb/243204/
      )

      Microsoft Distributed Transaction Coordinator (MSDTC) recovery techniques in Windows 2000 Cluster Server

      249694

      (http://support.microsoft.com/kb/249694/
      )

      How to move a Windows 2000 installation to different hardware

      250581

      (http://support.microsoft.com/kb/250581/
      )

      Windows 2000 keywords for searching the Microsoft Knowledge Base

      263532

      (http://support.microsoft.com/kb/263532/
      )

      How to perform a disaster recovery restoration of Active Directory on a computer with a different hardware configuration

      283223

      (http://support.microsoft.com/kb/283223/
      )

      Recovery of encrypted files on a server

      295932

      (http://support.microsoft.com/kb/295932/
      )

      Windows 2000 domain controllers restored with system state backups made prior to SP2 may not boot

      318715

      (http://support.microsoft.com/kb/318715/
      )

      A network adapter is missing in Device Manager after a full restore

      Article ID: 287061 – Last Review: October 12, 2012 – Revision: 5.0


      Applies to
      • Microsoft Windows 2000 Server
      • Microsoft Windows 2000 Advanced Server
      • Microsoft Windows 2000 Professional Edition
      • Microsoft Windows NT Workstation 4.0 Developer Edition
      • Microsoft Windows NT Server 4.0 Standard Edition
      • Microsoft Windows NT Server 4.0 Enterprise Edition
      • Microsoft Small Business Server 2000 Standard Edition
      • Microsoft BackOffice Small Business Server 4.0
      • Microsoft BackOffice Small Business Server 4.5
      • Microsoft BackOffice Server 2000
      • Microsoft BackOffice Server 4.0
      • Microsoft BackOffice Server 4.5
      kbbackup kbinfo w2000ntbackup KB287061

      Read the original:
      Windows NT 4.0 and Windows 2000 disaster recovery and backup and restore procedures

      How to troubleshoot general printing problems in Windows 2000 when you are using Office products

      This article describes the steps that you can use to troubleshoot printing problems in Microsoft Windows 2000 when you are using Microsoft Office products and covers the following topics:

      • General troubleshooting information
      • How to troubleshoot printing problems
      • How to troubleshoot physical problems
      • How to troubleshoot communication problems
      • How to troubleshoot Windows 2000 printing
      • How to troubleshoot common printing problems
      • Additional troubleshooting steps for printers that are connected to a network
      This article describes how to troubleshoot printing problems in Microsoft Windows 2000 when you are using Microsoft Office products.

      General troubleshooting information

      Successful troubleshooting depends on identifying the source of the problem. Printing problems occur because of trouble with the following:

      • The printing device
      • The connection between the printer and the network
      • Other printing components in Windows 2000
      • The network, protocols, and other communication components

      To solve printing problems, re-create the problem to identify the process. To determine the problem, test different scenarios. For example, if a network client cannot print to a certain printer and other users can, the problem is not with the physical printer or with the printer’s connection to the network.

      How to troubleshoot printing problems

      To solve most printing problems, use the following methods:

      • Verify that the physical printer is operational. If other users can print, the
        problem is probably not with the printer or with the print server.
      • Verify that the printer on the print server is using the correct printer driver. If print clients are using other operating systems, make sure that you installed all the drivers that are required for the other operating systems.
      • Verify that the print server is operational, make sure that there is sufficient disk space for spooling, and then make sure that the print spool service is running.
      • Verify that the client computer has the correct printer driver if print clients are using operating systems other than Windows 2000.

      How to troubleshoot physical problems

      • Check the physical printer and make sure that it is in the “ready to print” state. Print a test page from the printer console to verify the correct operation.
      • Check the cable that is connected to the printer and make sure that the cable is connected correctly. If the printer is connected directly to the network by using a network adapter, check the light on the card that indicates network connectivity.

      How to troubleshoot printer communication problems

      • Verify that you can communicate with the printer over the network. For example, if a printer communicates over TCP/IP protocol, try to ping the printer’s IP address to verify connectivity.
      • Verify that you can communicate to the print server from other computers.
      • Verify that the there are required for the printer are working, and verify that the client computer that is submitting the print job is working correctly. For example, for a Macintosh client, verify that the AppleTalk protocol is working correctly.
      • Verify that the print spool service is running on the print server.

      How to troubleshoot Windows 2000 printing

      The modularity of the printing architecture makes diagnosing problems fairly easy. Windows 2000 printing across a network includes seven processes that always occur. By testing each process, you can typically identify the problem.

      Collapse this tableExpand this table

      Process Verify each part of the process
      The administrator adds a printer and shares it.
      • Check the property of the logical printer. Make sure that the driver is correct for that printer.
      • Use the Add Printer Wizard to add another logical printer for the same physical printer to quickly identify if the problem is with the logical printer.
      • If you cannot locate network printers, or if you cannot find the printer port, you might have a network problem.
      • Verify that you are logged on as an administrator or as a member of the Administrator group.
      A network client connects to that share.
      • Check the property of the logical printer on the client computer. Make sure that the driver is correct for that printer.
      • Use the Add Printer Wizard to add another logical printer for the same physical printer to quickly identify if the problem is with the logical printer.
      • Check the user’s permissions to print to that printer, and then check the Group Policy settings for printers that are turned on.
      • If you cannot locate network printers, you might have a network problem.
      The client program creates a print job.
      • Check to see if the document that the client is trying to print includes only text or only graphics. Check the printer driver and the font settings.
      • Check to see if there is a problem with the separator page selection.
      • Try to reproduce the same print job from another client. If the print job prints correctly, the problem is probably not caused by this process.
      The client system sends the print job to the printer share on the print server.
      • Check the network transport–for example, TCP/IP, NWLink, or AppleTalk.
      • Check other network components that are required for printing–for example Print Service for Macintosh or Print Service for Unix.
      • Verify that the network is working correctly for the client. Check the network adapter and the intermediate network devices.
      • Verify that the print spool folder on the print server has not run out of disk space.
      • Try to send the print job to the spooler in another way, or from another program.
      The print server receives, spools, and alters the print job.
      • Check disk space for spooling.
      • Verify that the problem does not involve an incorrect data type, such as RAW or PScript1.
      • Try to change an EMF data type print job to the RAW data type to see if it solves the problem.
      The print server sends the print jobs to the printer.
      • Check network transport, such as TCP/IP, NWLink, NetBEUI, and other network devices.
      • Check the physical printer connection to the network.
      • Verify that the printer is ready to print.
      • Try to print from other network clients.
      The printer interprets the job and produces hardcopy output.
      • Verify that the printer is ready to print.
      • Try to print a test page from the printer console.

      How to troubleshoot common printing problems

      This section discusses general troubleshooting steps that you can use with either a local printer connected directly to the computer or with a printer that is connected to the network.

      Note For more information about network printing, see the “Additional steps for printers that are connected to the network” section.

      How to print a test page

      To print a test page, you must have Print permissions. You can also print a test page when you first install a printer.

      Note To make sure that you have Print permissions, contact your network administrator.

      To print a test page, follow these steps:

      1. Click Start, and then click Printers and Faxes.
      2. Right-click the printer that you want to test, and then click Properties.
      3. On the General tab, click Print Test Page.
      4. Click OK if the test page printed correctly.

      If the test page did not print correctly, continue troubleshooting for help resolving the printing problem.

      If you cannot print a test page, or if you cannot print in several or in all your Microsoft Windows programs, you may have one of the following problems:

      • A printer driver problem
      • A Windows problem
      • A hardware problem
      • A connectivity problem

      How to print from WordPad

      1. Start WordPad.

        To do this, click Start, point to Programs, point to Accessories, and then click WordPad.

      2. Type This is a test.
      3. On the File menu, click Print.

      If your printer prints a page that contains the words “This is a test”, the WordPad test is successful. Try to print from your program. If you cannot print from your program, or if you cannot print from several Microsoft Windows-based programs, go to the “Start Windows in Safe Mode” section.

      If you cannot print from WordPad, try to print at a command prompt.

      How to print at a command prompt

      To print at a command prompt by using a PostScript printer, follow these steps:

      1. Open a Command Prompt window.

        To do this, click Start, point to Programs, point to Accessories, and then click Command Prompt.

      2. Type copy con lpt1 at the command
        prompt, and then press ENTER.

        Note If your printer is connected to a port other than the LPT1 port, replace “lpt1″ with the correct port.

      3. Press CTRL+Z+ENTER.
      4. Type showpage at the command prompt.
      5. Press CTRL+Z+ENTER.

      If your printer prints a blank page, the connection between your computer and printer is fine.

      To print at a command prompt by using a non-PostScript printer, follow these steps:

      1. Open a Command Prompt window.

        To do this, click Start, point to Programs, point to Accessories, and then click Command Prompt.

      2. At the command prompt, type dir > lpt1 if your printer is connected to the LPT1 port.

        Note If your printer is connected to a port other than the LPT1 port, replace “lpt1″ with the correct port.

      3. Press ENTER.

      If you cannot print at a command prompt, try to start Windows in Safe Mode and then try to print at a command prompt again.

      How to start Windows 2000 in Safe Mode

      You can select from the following Safe Mode options when you start Windows 2000:

      • Safe Mode
        This option uses only the basic files and the generic drivers that are required to run Windows 2000 on your computer.
      • Safe Mode with Networking
        This option is the same as Safe Mode except that network connectivity also starts.
      • Safe Mode with Command Prompt
        This option is the same as Safe Mode except that a command prompt starts instead of Windows 2000.

      Safe Mode helps you diagnose problems. If a symptom does not re-appear when you start in Safe Mode, you can eliminate the default settings and the minimum device drivers as possible causes. If a newly added device or a changed driver is causing the problems, you can use Safe Mode to remove the device or to reverse the change.

      To start Windows 2000 in Safe Mode, follow these steps.

      Note You may want to print these instructions before you restart your computer.

      1. Click Start, and then click Shut Down.
      2. Click Restart, and then click OK.
      3. When you receive the following message, press F8:

        Please select the operating system to start.

      4. Use the arrow keys to select the appropriate Safe Mode option, and then press ENTER.

        Note The NUM LOCK key must be off before the arrow keys on the numeric keypad will function.

      5. Use the arrow keys to select an operating system, and then press ENTER.

      For additional information about Safe Mode for Windows, click the following article number to view the article in the Microsoft Knowledge Base:

      202485

      (http://support.microsoft.com/kb/202485/
      )

      Description of Safe Boot Mode in Windows 2000

      If you still cannot print at a command prompt in Safe Mode, check the cables, the switch boxes, and the connections. To do this, follow these steps:

      1. If you are connected to a switch box, try to remove the switch box, and then connect to the printer directly.
      2. Make sure that the printer is online and that it is connected.
      3. Try a self-test of the printer.

      If the self-test does not work, contact your printer manufacturer.

      How to check the printer driver

      To determine if there is a problem with your printer driver installation, remove and then reinstall your default printer driver. To do this, follow these steps:

      1. Click Start, point to Settings, and then click Printers.
      2. Right-click the default printer icon, and then click Delete.

        Note The default printer icon has a white check mark in a black circle in its upper-left corner.

      3. Click Yes to confirm that you want to delete the printer.
      4. Double-click Add Printer, and then click Next.
      5. Click Local printer, and then click Next.
      6. Click the port that you want your printer to use, and then click Next.
      7. In the Manufacturers list, click the name of your printer manufacturer.
      8. In the Printers list, click the name of your printer model.
      9. If you are not sure of the manufacturer or the model that you want, of if you do not see your printer model in the Printers list, see your printer documentation.
      10. Click Next, and then click Yes to make this your default printer.
      11. Click Next two times.
      12. Click Yes to indicate that you want to print a test page, and then click Next.
      13. Click Finish.

      Test your printer. To do this, try to print from WordPad.

      If you cannot print from WordPad after you reinstall the printer drivers, try to print by using the Generic/Text Only printer driver.

      How to install the Generic/Text Only printer driver

      The Generic/Text Only printer driver is a basic non-PostScript printer driver. Try to print by using the Generic/Text Only printer driver to determine if your printing problem is related to your printer driver.

      To do this, follow these steps:

      1. Click Start, point to Settings, and then click Printers.
      2. Double-click Add Printer, and then click Next.
      3. Click Local printer, and then click Next.
      4. Click the port that the printer is attached to, and then click Next.
      5. In the Manufacturers list, click Generic.
      6. In the Printers list, click Generic / Text Only.
      7. Click Next, and then click Yes to make this your default printer.
      8. Click Next two times.
      9. Click Yes to indicate that you want to print a test page, and then click Next.
      10. Click Finish.

      If the test page does not print, contact your printer manufacturer for more information.

      If the test page prints correctly, test your printer. To do this, try to print from WordPad.

      If you can print from WordPad, try to print from your program. If you can now print from your program, your original printer driver is incorrect or is incompatible with your system. Contact the printer manufacturer for the latest compatible drivers for your printer. You can continue to use the Generic/Text Only printer driver in the meantime, but you can only print standard black-and-white text.

      How to check the printer configuration files

      Corrupted printer configuration files can cause printing problems. Try to reinstall fresh copies of these files. To do this, follow these steps:

      1. Click Start, point to Settings, and then click Printers.
      2. Right-click the default printer icon, and then click Delete.

        Note The default printer icon has a white check mark in a black circle in its upper-left corner.

      3. Click Yes to confirm that you want to delete this printer.
      4. Open Computer Management.

        To do this, click Start, point to Settings, and then click Control Panel. Double-click Administrative Tools, and then double-click Computer Management.

      5. In the console tree, double-click System Tools, expand Services and Applications, and then click Services.
      6. In the Details pane, right-click Print Spooler, and then click Stop.
      7. In My Computer or in Microsoft Windows Explorer, delete all the files and folders in the following folder:

        C:WinntSystem32SpoolDriversW32X863

      8. If Windows is not installed on drive C in the Winnt folder, select the appropriate folder.
      9. If you cannot delete these files and folders after you stop the spooler service, or if you receive a message that states that the files are in use, follow these steps:
        1. Open Computer Management.

          To do this, click Start, point to Settings, and then click Control Panel. Double-click Administrative Tools, and then double-click Computer Management.

        2. In the console tree, double-click System Tools, expand Services and Applications, and then click Services.
        3. In the Details pane, double-click Print Spooler.
        4. On the General tab, under Startup, click Disabled, and then click OK.
        5. Restart your computer.

          You may now be able to delete the files.

      10. Open Computer Management.
      11. In the console tree, double-click System Tools, expand Services and Applications, and then click Services.
      12. In the Details pane, double-click Print Spooler.
      13. On the General tab, under Startup, click Automatic, and then click OK.

      After you update your printer files, reinstall your printer driver.

      To install a printer driver, follow these steps:

      1. Click Start, point to Settings, and then click Printers.
      2. Double-click Add Printer, and then click Next.
      3. Click Local printer, and then click Next.
      4. Click the appropriate port, and then click Next.
      5. In the Manufacturers list, click the name of your printer manufacturer.
      6. In the Printers list, click your printer, and then click Next.
      7. If you are not sure of the model or the manufacturer that you want, or if you do not see your printer model in the list of printers, see your printer documentation.
      8. Click Yes to make this your default printer, and then click Next two times.
      9. When you are prompted to print a test page, click Yes, click Next, and then click Finish.

      For a network printer, after you update the printer files, create a local port.
      To do this, follow these steps:

      1. Click Start, point to Settings, and then click Printers.
      2. Double-click Add Printer, and then click Next.
      3. Click Local printer, click to clear the Automatically detect my printer check box, and then click Next.
      4. Click Create a new port:, click Local Port, and then click Next.
      5. In the Enter a port name box, type the following text, and then click OK:

        serverprinter

        . In this example , server is the name of the printer server, and printer is the share name of the printer.

      6. In the Manufacturers list, click the name of your printer manufacturer.
      7. In the Printers list, click the name of your printer.
      8. If you are not sure of the model or the manufacturer that you want, or if you do not see your printer model in the list, see your printer documentation.
      9. Click Next, and then click Yes to make this your default printer.
      10. Click Next two times.
      11. Click Yes to indicate that you want to print a test page, and then click Next.
      12. Click Finish.

      If the test page does not print, you may have a network connectivity problem. Contact your network administrator.

      If the test page prints, your printing problem may have been caused by corrupted printer files. Set the network printer as your default printer, and then try to print from WordPad. To do this, follow these steps:

      1. Start WordPad.

        To do this, click Start, point to Programs, point to Accessories, and then click WordPad.

      2. Type This is a test.
      3. On the File menu, click Print.

      If your printer prints a page with the words “This is a test”, the WordPad test is successful.

      If the WordPad test is successful, try to print from your program. If you cannot print from the program, go to the “How to check the program” section.

      How to check the disk space

      Your computer may not have sufficient available disk space to print your document.
      To check the available space on your hard disk
      , follow these steps:

      1. Double-click My Computer.
      2. Right-click your system disk, and then click Properties.

      Note The system disk is wherever you installed Windows, typically drive C.

      A pie chart appears that indicates how much space on your disk is being used, and how much disk space is free.

      You want about 32 megabytes (MB) of free disk space to print a simple document. You may require more free disk space to print larger documents, such as documents that contain graphics. We recommend 120 MB of free disk space. Note that 1 gigabyte (GB) equals 1024 MB.
      If there is not sufficient disk space available, try to remove files and programs that you do not need. After you increase your available disk space, try to print from your program.

      How to check the program

      At this point, it has been determined that you can print from WordPad and that the printing issue seems to be specific to one program. The next set of troubleshooting steps will help you try to resolve the problem in the program. Think about what exactly the printing problem is.

      For example, does your program print graphics correctly, or are you having problems with a particular font? Does the problem occur in only one document, or in all documents in the program? As a test, try to print a blank page from the program. If this prints correctly, the program may have problems with memory or with fonts.

      To determine where the printing problem is, use the following methods:

      • Print a different, simpler file. For example, create a new document that contains only text.
      • If the document prints, try to add a graphic to the document that you just created.
      • Test different fonts to see if one of the fonts on the system is damaged.

      If the new document prints, the problem may be specific to the one document. To see if the issue is specific to something in the document, use the following methods:

      • Check the file. Save the document that you are trying to print and then paste a section of the document in a new file. If you cannot print graphics, paste one of the graphics in the new file. Close all files except the new file, and then try to print.

        If you can print your new file, your original document might require more memory than your computer has available. Your operating system might be low on memory. Try one or more of the following methods to free memory:

        • Quit any other programs that you are running
        • Close all documents except the one that you are trying to print.
        • Quit all open programs, and then restart your computer.
      • Check the fonts. If you suspect that the printing problem may be a damaged font, try to remove and then reinstall the font.

        For additional information about how to test and how to reinstall fonts, click the following article number to view the article in the Microsoft Knowledge Base:

        314960

        (http://support.microsoft.com/kb/314960/
        )

        How to install or remove a font in Windows

      Additional troubleshooting steps for printers that are connected to a network

      To help isolate and solve the problem, review the following methods:

      • Verify basic network connectivity. Check user rights, protocols, and share names to determine whether you can see the server. Try to copy a file to the server. If you cannot access the server, you might not be able to access the printer.

        On the Advanced tab, make sure that the printer availability time is correct.

        Create a local printer, and then redirect the port to the network server. Use the Add Printer wizard, click Local, and then type the server name and the printer name for the printer servernameprintername. This determines if you can copy files from the print server.

      • Check the available disk space on the print server. If there is not sufficient room to spool the print job, larger print jobs might not print where smaller print jobs do print.

        Contact your network administrator for more help.

      • Verify that you can establish a basic network connection. To do this, click Start, click Run, and then type server in the Open box.

        In this example, server is the name of the server that is sharing the printer.

        If a window opens and lists the names of the shares that are available on the server, there is a basic network connection between two computers that are sharing the printer.

        You may experience one of the following symptoms if there is no basic network connection between the two computers that are sharing the printer:

        • You receive an “Access Denied” error message.
        • You receive an “Unable to locate the server” error message.
        • A blank window appears.
      • Reinstall the printer driver. To determine if your printing problem is occurring because of a corrupted printer driver, remove and then reinstall your printer driver. To do this, follow these steps:
        1. Click Start, point to Settings, and then click Printers.
        2. Right-click the default printer icon, and then click Delete.

          Note The default printer icon has a white check mark in a black circle in its upper-left corner.

        3. Click Yes to confirm that you want to delete this printer.
        4. Double-click Add Printer, and then click Next.
        5. Click Local printer, click to clear the Automatically detect my printer check box, and then click Next.
        6. In the Port column, click a port that is already connected to your network printer, and then click Next.

          Note The port has a name that is similar to the following:

          serverprinter

          In the port name, server is the name of the printer server, and printer is the share name of the printer.

        7. If a network printer port exists, click it, and then click Next.

          If there is no network printer port, follow these steps:

          1. Click Create a new port:, select Local Port, and then click Next.
          2. In the Enter a port name box, type serverprinter. In this example, server is the name of the printer server, and printer is the share name of the printer.
        8. In the Manufacturers list, click the name of your printer manufacturer.
        9. In the Printers list, click the name of your printer, and then click Next.
        10. If you are prompted to keep the existing driver, click Replace existing driver, and then click Next.
        11. Click Yes to make this your default printer, and then click Next.
        12. If you are prompted to share this printer, click Not shared, and then click Next.
        13. Click Yes to indicate that you want to print a test page, and then click Next.
        14. Click Finish.

        Try to print from your program.

        If you can print, the printer driver that you removed from your computer was corrupted, and reinstalling it fixes the problem.

        If you cannot print, the printer driver on the server that you are connected to may be corrupted. Contact your network administrator for more help.

      • Print from a different computer. Printing from a different computer helps determine if the printing problem is specific to one computer.

        To print over the network from a different computer than the one that you typically use, log on to the network by using your user name and password. Try to print to the same printer that you are having problems printing to from the computer that you typically use.

        If you can print from a different computer, there may be a network connectivity problem between the printer and the computer that you typically use. Contact your network administrator for more help.

        If you still cannot print, try to establish a basic network connection from a different computer.

      • Establish a basic network connection. If you cannot print to the printer from another computer, see if there is a basic network connection between that computer and the printer server. To do this, follow these steps:
        1. On a different computer than the one that you typically use, log on to the network by using your user name and password.
        2. Click Start, click Run, and then type server in the Open box.

          In this example, server is the name of the print server.

        If a window opens and lists the shares that are available on the printer server, there is a basic network connection between this computer and the printer server. There may be a network connectivity problem between the printer server and the computer that you typically use, or corrupted printer driver files may have been copied from the printer server to the computer that you typically use.

        If you receive an error message or a blank window appears, your network account may not have sufficient rights to see or to print to the print server.

      • Establish a basic network connection from a different user’s computer. If a window opens on the other user’s computer and lists the shares that are available on the printer server, your own network account may not have sufficient rights to see or to print to the printer server. Contact your network administrator for more help.

        If the other user receives an error message or a blank window appears, there may be a network problem or a problem with the printer server. Contact your network administrator for more help.

      • Map a local port to the network printer share. To do this, follow these steps:
        1. Open a Command Prompt window.

          To do this, click Start, click Run, type cmd in the Open box, and then click OK.

        2. Type net use at the command prompt, and then press ENTER.
        3. If the LPT1 port is already mapped to a network share, type net use lpt1 /d at the command prompt, and then press ENTER.

          Note This command deletes the current mapping of the parallel port LPT1.

        4. Type net use lpt1:serverprinter, and then press ENTER.

          In this example, server is the name of the server, and printer is the share name of the printer.

          Notes

        If you can successfully map a local port to the network printer share, try to print from your program.

        If you can print from your program to the shared network printer, establish a persistent connection so that you can print to the network printer share after you restart Windows.

        To establish a persistent connection, follow these steps:

        1. Open a Command Prompt window.

          To do this, click Start, click Run, type cmd in the Open box, and then click OK.

        2. Type net use lpt1 /d at the command prompt to delete the current mapping of the parallel port LPT1, and then press ENTER.
        3. Type net use lpt1:serverprinter/ persistent, and then press ENTER.

          In this example, server is the computer name of the server, and printer is the share name of the printer.

          Notes

        If you still cannot print, contact your network administrator for more help.

      For additional information about how to troubleshoot problems in Windows 2000, click the following article number to view the article in the Microsoft Knowledge Base:

      281770

      (http://support.microsoft.com/kb/281770/
      )

      How to perform clean-boot troubleshooting for Windows 2000

      Article ID: 871146 – Last Review: October 12, 2012 – Revision: 5.0


      Applies to
      • Microsoft Office Publisher 2003
      • Microsoft Office PowerPoint 2003
      • Microsoft Office Outlook 2003
      • Microsoft Office OneNote 2003
      • Microsoft Office Access 2003
      • Microsoft Word 2002
      • Microsoft Publisher 2002 Standard Edition
      • Microsoft PowerPoint 2002 Standard Edition
      • Microsoft Outlook 2002 Standard Edition
      • Microsoft FrontPage 2002 Standard Edition
      • Microsoft Excel 2002 Standard Edition
      • Microsoft Access 2002 Standard Edition
      • Microsoft Word 2000
      • Microsoft Publisher 2000 Standard Edition
      • Microsoft PowerPoint 2000 Standard Edition
      • Microsoft Outlook 2000 Standard Edition
      • Microsoft FrontPage 2000 Standard Edition
      • Microsoft Excel 2000 Standard Edition
      • Microsoft Access 2000 Standard Edition
      • Microsoft Windows 2000 Server
      • Microsoft Windows 2000 Professional Edition
      • Microsoft Project 2000 Standard Edition
      • Microsoft Office Project Professional 2003
      • Microsoft Office Project Standard 2003
      • Microsoft Office Visio Professional 2003
      • Microsoft Visio 2002 Professional Edition
      • Microsoft Visio 2002 Standard Edition
      • Microsoft Project 2002 Professional Edition
      kbtshoot kbprint kbhowto KB871146

      Other Support Sites

      Community

      Get Help Now

      Article Translations

      Related Office 2000 Web Sites