???? ID: 320141 - ????? ???????: 03 ?????? 2010 - ??????: 2.0

TO HOW: ??????? ??? ????? ??? ?? SQL ????? ?? ?? ?? ???????? ???? ??? ?????? Visual Basic .NET ?? ????? ??

?????? ??????This article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.

?? ????? ??

??? ?? ??????? ???? | ??? ?? ??????? ????

??????

?? ??? ?? ??? ???? ????? ???? ?? ?? ?? ??? ????? ????? ?? ??? ???? SQL Server ?????? ??? ?????? ????? ????? ??? ??????? ???? ?? ??? ???? ?????

??????????


?? ????? ????????? ??????? ??? SQL ????? ?? ????? ???? ?? ?? ????? ??? ?? ??? ?????? ???????? ?? ??? DataTables ?? ??? ???? retrieves ??? ?? ?? ????? ???? ?? ???? MSDE ?? ??? ??; ???????, ?? ????????? ??????? MSDE ?? ??? ????? ???? ??? MSDE ?? ??? ?? ????????? ?? ????? ???? ???? ?? ???? ??? ??????? ?? ??? ??????????? ???????? ???? ?? ????


???? SQL Server ????? ????? ??? ??? ????? ?????? ????? ?? ?? ?? ????????? ??? ?? ??? ????????? ??? ?? ???? ?? ??? ???? ???? ???????? ???? ?? ?????? ?? ??? ??? ???????? ????, ??? ?? Identity_ ???? ?? ??? ??? ?? ????? ??? ??? ?? ???? SQL Server ????? ????? ?? ??? ??????? ???

?????

  1. Visual Studio .NET ??? ??????? ????, ?? ???? ??? ?? ??? Windows ????????? ?? Visual Basic ????????? ?????:
    1. ????? ???????????? ??,????? ????-????? ????, ?? ???? ????????????.
    2. ???????? ?????????????? ????? ???, ????? ????Visual Basic ??????????? ???????????????? ???????? ????-????? ????, ?? ???? ???Windows ??????????? ???????????????.
  2. Windows ??? ?? ?? ??????? ?? ?? ??? ?????? ??????
  3. ??? ????? ?? ????? ?? ????? ?????? ??????:
    Imports System.Data.SqlClient
  4. ??? ?? ????? ??? ??????? ????? ?? ????? ????:
    Dim ds As New DataSet()
    
    Dim cnNorthwind As New SqlConnection("server=(local);integrated security=sspi;database=Northwind")
    Dim cmSelect As New SqlCommand("select employeeid,firstname,lastname from employees", cnNorthwind)
    
    Dim stInsert As String
    stInsert = "insert into employees (firstname,lastname) values(@Firstname,@Lastname);select employeeid,firstname,lastname from employees where employeeID = @@identity"
    Dim cmInsert As New SqlCommand()
    
    With cmInsert
       .CommandText = stInsert
       .CommandType = CommandType.Text
       .Connection = cnNorthwind
       .Parameters.Add(New SqlParameter("@firstname", Data.SqlDbType.VarChar, 25, "firstname"))
       .Parameters.Add(New SqlParameter("@lastname", Data.SqlDbType.VarChar, 25, "Lastname"))
    End With
    
    Dim daNorthwind As New SqlDataAdapter()
    With daNorthwind
       .SelectCommand = cmSelect
       .InsertCommand = cmInsert
    End With
    
    daNorthwind.Fill(ds, "employees")
    Dim dr As DataRow
    dr = ds.Tables("employees").NewRow
    dr(1) = "John"
    dr(2) = "Doe"
    ds.Tables("employees").Rows.Add(dr)
            
    daNorthwind.Update(ds, "employees")
    ds.AcceptChanges()
    Dim i As Int16
    For i = 0 To ds.Tables("Employees").Rows.Count - 1
        With ds.Tables("Employees")
           Debug.WriteLine("EmployeeID: " & .Rows(i)(0).ToString)
           Debug.WriteLine("Employee Firstname: " & .Rows(i)(1).ToString)
           Debug.WriteLine("Employee LastName: " & .Rows(i)(2).ToString)
        End With
    Next i
    					
  5. SQL ????? ?? MSDE ??????? ?? ??????????? ???? ?? ??? ??????? ???????? ????????? ?????
  6. ????????? ??????
  7. ??? ????? ?????

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

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

???? ?? ????????? ?? ????? ???? ?? ???? MSDE ?? ?? ????? ???? ????? ???? ??????????????? ?????? (DTS) SQL ????? ?? Microsoft Access ?? ??? ????????? ??????? ?? ???? ???? ?? ????

??????

?????? ?????? ?? ??? ????? ??? ?? ??? ?? ?? ???? ??? ???????? ??????? ?? ??? ?????? ?? Microsoft ???????? ??? ????? ?? ??? ????? ???? ???????? ?? ????? ????:
320301  (http://support.microsoft.com/kb/320301/EN-US/ ) HOWTO: ???? Windows ??????? ????????? ?????? ??? ??? ???? ?? ????? ????? ?? ??? ?????? ?????? ?????? ????
DTS ?? ????? ???? ???? ?? ???? ??? ???????? ??????? ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
242377  (http://support.microsoft.com/kb/242377/EN-US/ ) ???? ?????????????? (DTS) ?????? ?? ????? ???? ????
SQL ????? ?? ???? Microsoft Access ??????? ??? ?????? ???? ?? ???? ??? ???????? ??????? ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
237980  (http://support.microsoft.com/kb/237980/EN-US/ ) TO HOW: SQL ????? ?? ??? ???? Access ??????? ?????? ????
Visual Basic 6.0 ??? ??????? ?? ????? ?? ??????? ???? ?? ??? ???? ???? ?? ???? ??? ???????? ??????? ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
170147  (http://support.microsoft.com/kb/170147/EN-US/ ) HOWTO: ??????? ????? ????? ???????? RDO ?? ????? ???? ?? ???



???? ???? ???? ??:
  • Microsoft ADO.NET 1.1
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft SQL Server 7.0 Standard Edition
  • Microsoft SQL Server 2000 Standard Edition
  • Microsoft SQL Server 2000 64-bit Edition
??????: 
kbhowtomaster kbmt KB320141 KbMthi
???? ?????? ???????????? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:320141  (http://support.microsoft.com/kb/320141/en-us/ )