VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form1 
   Caption         =   "VB6 例11-11 ADO与SQL"
   ClientHeight    =   1920
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4950
   LinkTopic       =   "Form1"
   ScaleHeight     =   1920
   ScaleWidth      =   4950
   StartUpPosition =   3  '窗口缺省
   Begin MSAdodcLib.Adodc Adodc1 
      Align           =   2  'Align Bottom
      Height          =   330
      Left            =   0
      Top             =   1590
      Width           =   4950
      _ExtentX        =   8731
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.TextBox Text1 
      DataField       =   "学号"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1320
      TabIndex        =   4
      Top             =   60
      Width           =   1335
   End
   Begin VB.TextBox Text2 
      DataField       =   "姓名"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   3540
      TabIndex        =   3
      Top             =   60
      Width           =   1215
   End
   Begin VB.TextBox Text3 
      DataField       =   "课程"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1320
      TabIndex        =   2
      Top             =   540
      Width           =   1335
   End
   Begin VB.TextBox Text4 
      DataField       =   "成绩"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   3540
      TabIndex        =   1
      Top             =   540
      Width           =   1215
   End
   Begin VB.PictureBox Picture1 
      AutoSize        =   -1  'True
      DataField       =   "照片"
      DataSource      =   "Adodc1"
      Height          =   855
      Left            =   60
      ScaleHeight     =   795
      ScaleWidth      =   675
      TabIndex        =   0
      Top             =   60
      Width           =   735
   End
   Begin VB.Label Label1 
      Caption         =   "姓名"
      Height          =   255
      Index           =   1
      Left            =   2940
      TabIndex        =   8
      Top             =   180
      Width           =   495
   End
   Begin VB.Label Label1 
      Caption         =   "课程"
      Height          =   255
      Index           =   2
      Left            =   840
      TabIndex        =   7
      Top             =   660
      Width           =   495
   End
   Begin VB.Label Label1 
      Caption         =   "成绩"
      Height          =   255
      Index           =   3
      Left            =   2940
      TabIndex        =   6
      Top             =   600
      Width           =   495
   End
   Begin VB.Label Label1 
      Caption         =   "学号"
      Height          =   255
      Index           =   0
      Left            =   840
      TabIndex        =   5
      Top             =   180
      Width           =   495
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
    Adodc1.Caption = Adodc1.Recordset.AbsolutePosition
End Sub

Private Sub Form_Load()
    Dim sql As String, mlink As String, mpath As String
    mpath = App.Path
    If Right(mpath, 1) <> "\" Then mpath = mpath + "\"
    sql = "Select 学生成绩表.*, 基本情况.姓名, " _
    & "基本情况.照片 From 学生成绩表, 基本情况 " _
    & "Where 学生成绩表.学号 = 基本情况.学号"
    mlink = "Provider=Microsoft.Jet.OLEDB.3.51;"
    mlink = mlink + "Persist Security Info=False;"
    mlink = mlink + "Data Source=" + mpath + "student.mdb"
    Adodc1.ConnectionString = mlink
    Adodc1.CommandType = adCmdUnknown
    Adodc1.RecordSource = sql
    Adodc1.Refresh
End Sub

