Visual Studio .NET ??? ???????? ???????????? ???? ???? ?? ??? ???? ????

???? ?????? ???? ??????
???? ID: 316549 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

?? ????? ??

??????

?? ??? ?? ??? ???? ????? ???? ?? ?? ?? ?? ???? ??? ???? SQL Server ???????? ??????????? ?????? ??????????? ???????? ?? ????? ?? ???????? approach ?? ?? ????? ?????

???? Visual Studio .NET ?????? ?? ???? ?? Visual Studio ????????? ?? independently SQL Server ???????? ???????????? ???? ???? ?? ??? ????? Explorer ????? ?? ????, ?? ?????? ???? ??? ??? ???????? ????????? ?? ??? ???????? ??? ?? Visual Basic, ????? C# ?? ????? J# ????????? ??? ?? ???

?????? 1: ???? ?????????? ??? ??? ???????? ????????? ???? ????

  1. ????? Explorer ??????

    ???:: It is not necessary to add a Data Connection to work with a SQL Server server because SQL Server servers are listed under the Servers node also. You will use the Servers node in the steps that follow; however, you can use a Data Connection to you SQL Server server in the same way.
  2. ?? ????????????node in Server Explorer, expand theSQL ?????machine name, expand theSQL ?????node, expand theSQL ?????instance, expand theNorthwind database??? ?? ???, ?? ???? ??? ??????? ????stored procedures??? ???
  3. ????-????? ????CustOrderHiststored procedure and then clickStep Into Stored Procedure.
  4. TheRun stored proceduredialog box opens, which lists the parameters of the stored procedure. ??????:ALFKIas the value for the@CustomerID???????? ????? ?? ???? ??? ????? ????OK.
  5. ????? Visual Studio ??????? ?????? ??? ?? ????? ?? ?? ???????? ????????? ?? ??? ????????? ???? ??? ???????? ????????? ?? ???????? ????? ???? ?????? ??????? ???? ??? ???????? ????????? ?? ?????? ?? ??? ????? ???? ?? ??? F11 ??????
  6. ?????? ????? ??? ????? ????? ????????? ??, ?? ??? ???????? ????? ???? ??:
    ????????? ' SQL ?????: T-SQL ' ??? 0 (0x0) ?? ???? ???

?????? 2: ???????? ??? ?? ???? ???????? ????????? ???

  1. ??? ??? Visual Basic Windows ????????? ????? ??????????
  2. ?????? ???????Form1 ?? ??? ???????? ????? ????? ?? ????? Form1 ??? ????? ?? ????? ?? ??? ?? ????? ?????? ??????:
    Imports System.Data.SqlClient
    					
  3. ??? ????? ??? ?? ????????? ?????Button1_Click????? ?????????:

    ???:: ??????? ???????? ?? ???? ?????? ?? ??? ?????? ?? ??? ??? ??????? ?????
            Dim cn As SqlConnection
            Dim strCn As String
            Dim cmd As SqlCommand
            Dim prm As SqlParameter
            strCn = "Data Source=(local);Initial Catalog=Northwind;" & _
                "Integrated Security=SSPI"
            cn = New SqlConnection(strCn)
            cmd = New SqlCommand("CustOrderHist", cn)
            cmd.CommandType = CommandType.StoredProcedure
            prm = New SqlParameter("@CustomerID", SqlDbType.Char, 5)
            prm.Direction = ParameterDirection.Input
            cmd.Parameters.Add(prm)
            cmd.Parameters("@CustomerID").Value = "ALFKI"
            cn.Open()
            Dim dr As SqlDataReader = cmd.ExecuteReader
            While dr.Read
                Console.WriteLine("Product ordered: {0}", dr.GetSqlString(0))
            End While
            dr.Close()
            cn.Close()
    					
  4. ?????? Explorer ???, ????????? (???? ??????) ?? ????-????? ???? ?? ?????????????? ????? ????,??????????? ??????? ?? ?? ??? ???? ?? ??? ???? ??? ???SQL ????? ?????????? ????????? ???????????? ????????? ???? ???? ????? ???? ?? ??? ??????
  5. ??? breakpoint ??? ?? ????? ?????? ?? ??? ????:
           Dim dr As SqlDataReader = cmd.ExecuteReader
    					
  6. ????? Explorer ???, ????? ?? ?????CustOrderHist?????? 1 ??? ???? ?????? ????????? ?? ???????? ????? ???????? ????????? ?? ????-????? ????, ?? ???? ??? ????? ???????????? ????????? ?? ??????? ????.
  7. ???????? ????????? ??? ?? breakpoint ??? ???, ??? ?? ???????? ????? ?? ???? ???? ?? ??? ?? ??? ?????
  8. Visual Basic ????????? ?? ????? ?? ??? F5 ??????
  9. Form1 ????? ???? ??, ?? ????? ???????? ???. ??? ????? breakpoint ???? ?? ??? ?? ?? ??? ???? ?? ???? ???????? ????????? ?? ??? ???? ???? ???
  10. F11 ?????? ????? ?? ?? ???????? ???ExecuteReader???????? ????????? ????? ??? ?????? ???
  11. F11 ??? ?? ?????? ???????? ?????????, ?? ??? ???? ??? ??? ??? ?? ??? ?????? ?? ????????? ???? ??? ?? ???? Visual Basic ????????? ?? ??? ???????? ???? ??, ?? ????? ???? ?? ??? ????????? ?? ????? ???
  12. Visual Basic ??? ?? ?????? ?? ??? ?? ???????? ????????? ??? ?? ??? ?? ??? ???? ???? ?? ??? ?? ??? ???? ?????? ??? ????? breakpoint Visual Basic ??? ??? ???????? ????????? ?? ??? ???? ?? ???? ?????? ?? ??? ????? ??? ??? ?? ??? ???, ?? ?? ??? ?? ???? ????? breakpoint ????? ??????:
            While dr.Read
    					

?????? ??????

  • Visual Studio ??? ?? ???? ???????? ????????? ??? ???, ?? ??? ?? ????? ???? ?????? SQL ??? ???????????????? ???????? ???????? ??????????
  • ???????? ????????? ??? ?? ?????? ?? ??? ???? ?? ??? ???? ??? breakpoint ?? ????: ???????? ????????? ??? ??? ???? ????? ??????, ????? ?? ???????? ????????? ?? ???????? ????????? ?? ??? ????? ?? ??????? ???? ??????
  • Visual Studio ??? ?? ?????? ?? ??? ?? ??? ???????? ????????? ??? ??????? ?? ??? ?? ??? ???? ???? ?? ??? ?? ??? ???? ?????? ??? breakpoint ???? ????? ?? ??? ????????? ??? ???????? ????????? ?? ???????? ?? ???? ??????, ??? ?? ???????? ????????? ??? ??????? ?? ??? ????? ???? ?? ??? ????? ???
  • ????? ?? ??????????? ????????, ?? ??? ????? "???????? ?? SQL ???????" Visual Studio .NET ??? ?????? ???? ??? ?? ???????? ??????

???????? ????????? ??????? ?? ??????

???????? ???????????? ???? ???? ?? ?? ?? ?? ???? ? ?? ?? Visual Studio ??? ???? ???? ??? ? ???? ?? ?????? ?????? ?? ???? ????? ??:
  • ?? ???? ???? ?? ???? "???" ?????????
  • ?? ???? ???? ?? ???? "??????? ???? ?? ???? ????."
  • ?? ??? ???????? ?? ???? ????????? ???? ?? ???? ???
  • ?????? ?? ?? ?? ??? ??? ???? ???, ?? ???? ???????? ?? ???? ?? ??????? ???? ??????? ??? ?? ??? ??? ????
  • ?????? ?? SQL ??? ?? ?????? ????????? ???? ???? ???? ???

??????

Visual Basic 6.0 ??? ??????? ?? ???? ??? ???? ??????? ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
170496Visual Basic ?? ???????? ???????????? ??????? ?? ??? ?????????
???? ??????? ?? ???, ????? Microsoft ??? ???? ?? ???? (Visual Studio .NET ??? ??? "??????? SQL" ???? ?? ????? ?? ????????):
SQL ???????
(vs.71) http://msdn2.Microsoft.com/en-us/library/zefbf0t6 .aspx

???

???? ID: 316549 - ????? ???????: 04 ?????? 2010 - ??????: 2.0
???? ???? ???? ??:
  • Microsoft ADO.NET 1.1
  • Microsoft Visual J# .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual C# .NET 2002 Standard Edition
  • Microsoft Visual C# .NET 2003 Standard Edition
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
??????: 
kbhowtomaster kbsqlclient kbsystemdata kbmt KB316549 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:316549

??????????? ???

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com