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

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

?? ??? ??????

??????

???? ??? ??????? ???? ????? ??????? ??? ???? ????? ????????? ??????? SQL Server ?????? ??????? ??????? ???????? ????? ?? ???????.

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

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

  1. ??? ?????? ??????.

    ??????: ??? ???????? ?????? "????? ??????" ??????? ?? ???? SQL Server ???? ??? ??? ?????? SQL Server ??? ???? ?????? ?????. ??? ?????? ???? ?????? ?? ??????? ??????? ? ??? ???? ????? ??????? "????? ??????" ???? SQL Server ???? ???? ???????.
  2. ??? ???? ?????? ?? "?????? ????" ?? ?????? ??? ???? SQL Server ?? ?????? ???? ?????? SQL ? ?? ?????? ???? SQL Server ? ?? ?????? ???? ????? ???????? Northwind ? ?? ?? ?????? ???? ????????? ???????.
  3. ???? ??? ?????? ?????? ??? ??????? CustOrderHist ????? ?? ???? ??? ?????? ???? ??? ????? ????.
  4. ??? ???? ?????? ????? ??????? ?????? ????? ???? ?????? ????? ????. ??? ALFKI ????? @ ???? ?????? ??????? ??????? ?? ???? ??? ?????.
  5. ?? ???? ????? Visual Studio ??? ???? ???? ?? ??????? ??????. ??? ????? ??? ??? ???? ??????? ?? ??????? ??????. ???? F11 ?????? ??? ??????? ?????? ??? ????????.
  6. ?? ?????? "?????" ? ??? ??? ??????? ??????? ? ????? ???? ??? ????? ???????:
    ???????? ' SQL ??????: T-SQL ' ?? ?? ????? ?? ??? 0 (0x0).

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

  1. ????? "?????" ???? Windows Visual Basic ???????.
  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. ?? "?????? ??????" ???? ??? ?????? ?????? ??? ??????? (?? ????) ?? ??? ????? ???????. ???? ??? ????? ????? ?? ?????? ?? ??? ???? ???????? ????? ???? SQL ??? ?????? ????? ?????? ????? ??????? ??????.
  5. ????? ???? ???? ??? ????? ?????? ?? ????????? ????????:
           Dim dr As SqlDataReader = cmd.ExecuteReader
    					
  6. ?? "?????? ????" ?????? ??????? CustOrderHist ????? ??? ?? ???? ?? ???? 1. ???? ??? ?????? ?????? ??? ??????? ?????? ??? ?? ???? ??? ????? ????? ????.
  7. ????? ???? ???? ?? ????? ???? ?????? SELECT ??? ??? ????????? ???????? ??????? ??????? ???.
  8. ???? F5 ?????? ????? Visual Basic.
  9. ??? ???? "Form1" ? ???? ??? ?? ?????. ???? ????? ????????? ???????? ??? ???? ??????? ????? ??? ??????? ??????? ??????.
  10. ???? F11. ??? ????? ??????? ?? ????? ExecuteReader ??? ???? ??????? ??????.
  11. ???? F11 ???? ????. ????? ??? ???? ?? ????????? ???????? ?? ??????? ?????? ?????? SELECT. ?? ???? ?????? ??? ????? Visual Basic ???? ????? ??????? ??? ????????.
  12. ???????? ??? ?????? ???? ????????? ???????? ?? Visual Basic ??? ?????? ?? ??????? ?????? ??? ???? ????? ???? ???? ???? ?? ????????? ???????? ?? Visual Basic ??? ????????? ??? ??????? ??????. ??? ???? ??????? ?? ????? ????????? ???????? ?? ??? ?????? ? ????? ????? ???? ???? ?????? ??? ????? ??????:
            While dr.Read
    					

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

  • ?????? ??? ????? ???? ?? ????????? ???????? Visual Studio ??? ????? ????? SQL ?? ????? ??????? ?? ?????? "?????".
  • ?????? ??? ????????? ???????? ??????? ?????? ??? ???? ????? ???? ???? ?? ??????? ?????? ????. ????? ??????? ??????? ??? ??????? ?????? ????? ??????? ?????? ?? ????.
  • ???????? ??? ?????? ???? ????????? ???????? Visual Studio ??? ????? ????? ????? ???? ??? ???? ????? ???? ???? ?? ???????? ???????? ??????? ?? ???? ??? ????? ??????? ??????. ????? ??? ????? ???????? ???????? ??? ???????? ??? ????? ????? ??????? ??????.
  • ?????? ??? ?????? ????? ?????? ???? ?????? ?????? "????? ????? SQL ???????" ?? Visual Studio .NET ???????.

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

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

?????

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

???????

???? ???????: 316549 - ????? ??? ??????: 25/???? ??????/1428 - ??????: 5.6
????? ???
  • Microsoft ADO.NET (included with the .NET Framework)
  • 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
????? ??????: 
kbmt kbhowtomaster kbsqlclient kbsystemdata KB316549 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????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