????? ?????? ????? ???? ???? COM + ?? ???? Visual Basic

?????? ????????? ?????? ?????????
???? ???????: 271284 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

?? Microsoft Windows 2000? ????? ????? ????? ???? ???? ????? ??? ???? ????? ???????? ?????? (DLL) ???? ?? COM + ??? ???????. ??? ??????? ????? ????????? ?????? ????? ????? ???? ??? ?? ????? ?? ?????? ??? ???? ?????? ?????? ??????. ????? ??? ??????? ??? ????? ?????? ?????? ???? ????? ????? COM + ?????? ????? ??????? ?????? Visual Basic ???? ??????? ?????? ?????? ???????.

??????? ????

????? ?????? ????????? ?????? ????? ????? ????? ?????? ???? ?????? ???? ?????? ???? ????? ??????? ????? ????????. ????? ?? ??????? ????? ?????? ???? ????? ?? ???? ????? ??????? ?? ??? ????? ????? ?? ????????? ???????? ???????. ?????? ??? ???? ????? ?????? ??? ??? ????? ?????? ?????? ?? ???? ??????? ???? ????? ??? ????? ??????? ???? ???? COM +; ?? ??? ???? ???? ??? ????? ????????? ???????? ?????? ?? ????? ????? DLL ??????. ???????? ??? ????? ??????? ????? ????? ???????? ?? ????? ??????? ????? ?????? ???? COM + ?????? ?? ????? ??????? ??? ?? ???? ?????? ??? ???? ?????? ?????? ?????? ???? ?? ?? ??????.

????? ????? ????? ???? ???? COM +

??? ?? ???? ???? Visual Basic ?????? ????? IObjectConstruct COM + ?????? ?????? ?????? ????? ?? ?????? ??? COM + ?????? ????? ??????? ???? ?? ????? ??. ??? IObjectConstruct ????? ???? ?????? ????? (IObjectConstruct_Construct) ????????? ??? ????? ???? ???? ??????. ????? ??????? ???? ???? ???? ?? ?????? ?????? ??? ??? ??????? ?????? ??? ???? COM + ?????? ????? ???????. ?????? ???? ???? ??? ????? ??? ??????? ?????? ??????? ???????:
  1. ???? ????? DLL ActiveX ???? ?? Visual Basic.
  2. ????? ????? ??????? "prjConstruct".
  3. ????? ????? ??? ?????? ??????? "clsConstruct".
  4. ????? ????? ??????? ??? ????? 2.5 ?????? ?????? ActiveX "?" ????? ????? COM +.
  5. ??? ???? ???????? ???????? ??????? ?? ??? ?????? ???????:
    'General Declarations Section
    Implements IObjectConstruct
    Dim connstr As String
    
    
    Private Sub IObjectConstruct_Construct(ByVal pCtorObj As Object)
    
    Dim mConstructString As IObjectConstructString
    Set mConstructString = pCtorObj
    connstr = mConstructString.ConstructString
    
    End Sub
    
    Public Function GetAuthors() As ADODB.Recordset
    
    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    
    Set cn = New ADODB.Connection
    cn.Open connstr
    
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.Open "Select * from Authors", cn, adOpenStatic, adLockBatchOptimistic
    Set rs.ActiveConnection = Nothing
    
    Set GetAuthors = rs
    GetObjectContext.SetComplete
    
    End Function
    						
    ??? ????? ?????? ?????? ???? ????? ????? IObjectConstruct_Construct ?????? ????? ?????? ???? COM +. ??? ?? ???? ????? ???? ????? ????? ??? ????? IObjectConstructString. ??? IObjectConstructString ????? ????? ???? ConstructString ???? ???? ????????? ?????? ????? ?????? ???? COM +. ???? ????? ????? ??? ????? ????? ????? ?????? ?????? ????????? ?? ???? GetAuthors.
  6. ????? DLL. ?????? ????? ???? + COM ???????? ???? prjConstruct.clsConstruct ???? ??????? ???????:
    1. ?? "???? ??????" ? ???? ??? ????? ?????? ?? ???? ??? ????? ???????? ???? ?????? ???????? ?????? ????? Microsoft ???????? (MMC).
    2. ???? ??? ?????? ????? ????????Computers???? ????????? ? ????? ??????? COM +. ???? ??? ??????? + COM.
    3. ???? ??? ?????? ?????? ??? ??????? + COM ? ??? ??? ???? ?? ???? ??? ?????.
    4. ????? ????? ?? ???? ?????? ???? ???? VBComPlusTest ?????? ????? ??????? ?????? ??? ???????? ?????? ?????? ???????? ??????.
    5. ???? ??????? ?? ???? ??? ?????. ???? ??? ??? ????? ????? ????? COM + ???? ??????? ???????? ???? Visual Basic prjConstruct.clsConstruct.
  7. ?????? ???? prjConstruct.clsConstruct ?? ????? "VBComPlusTest COM +" ? ???? ??????? ???????:
    1. ?? ?????? ???????? MMC ?????? ???????? ???? ??? ?????? ?????? VBComPlusTest. ???? ??? ?????? ?????? ????????.
    2. ???? ??? ?????? ?????? ??? ?????? ? ??? ??? ???? ?? ???? ??? ????????.
    3. ?? COM ???? ????? ????? ? ???? ??? ?????? ???? ??? ????? ???? (??????) ????? ? ?? ??? prjConstruct.dll ?? ???? ??? ??????.
    4. ???? ??????? ?? ???? ??? ?????.
  8. ??? ?????? "?????" prjConstruct.clsConstruct ???? Visual Basic.
  9. ??? ????? ??????? "???????" ? ??? ???? ???????? "????? ????" ???????.
  10. ?? ?????? ???? ????? ????? ????? ????? ADO ??????? ??? ?? ???? ??? ?????:

    ??????: ?????? ??? ??????? ????? ????? ?????? Microsoft SQL Server pubs (????????).
    "Provider=SQLOLEDB;Data Source=<Your SQL Server>;Initial Catalog=pubs;" & _
                       "User Id=<User Id>;Password=<Password>"
    					

????? ??????? ????? ???? ???? COM +

  1. ???? ????? EXE ????? ???? ?? Visual Basic ??????? ???? Visual Basic COM +. ??? ????? Form1 ???? ???????.
  2. ????? ???? ????? (List1) ?? ??? (Command1) Form1.
  3. ??? ???? ???????? ???????? ??????? ?? ????? Click Command1:
    Dim obj As Object
    Dim rs As Object
    
    Set obj = CreateObject("prjConstruct.clsConstruct")
    Set rs = obj.GetAuthors()
    Do While Not rs.EOF
      List1.AddItem rs.fields("au_fname")
      rs.movenext
    Loop
    
    Set obj = Nothing
    					
  4. ??? ??????? EXE ????? ?? ??????.
  5. ???? ??? Command1 ???? ???? ??????? ?? ??????? ?????? ?? ???????? ?? ?????? ????.
??? ????? ????? ?????? ???? COM + ? ????? ??????? DataSource ?? ????? ?????? ??????? ??? ???? SQL ?????? ????? ????? ????? ?????? pubs (????????). ??? ????? ????????? ???????? ?????? ??? ??????? ??????? ?? ???? ?????? ???? ?????. ?????? ??? ????? ??? ???? ??? ?????? ???? ?? ????? ?????? SQL Server pubs (????????) ??????.

???????

???? ???????: 271284 - ????? ??? ??????: 11/????? ??????/1425 - ??????: 1.2
????? ???
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
????? ??????: 
kbmt kbhowto kbmdacnosweep KB271284 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????271284

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

 

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