1. 程式人生 > >邢笑然 廊坊師範學院資訊科技提高班 十二期

邢笑然 廊坊師範學院資訊科技提高班 十二期

Private Sub cmdInquiry_Click()
    Dim mrc As ADODB.Recordset
    Dim txtSQL As String
    Dim MsgText As String
    Dim strStdinfo(3) As String  ‘定義欄位名
    Dim strRelationship(2) As String   ’定義組合關係
    Dim D  ’定義標籤
    Dim a, b As Integer
    For a = 0 To 2
    Select Case Combo1(a).ListIndex                         '設定欄位名的選項
        Case 0
        strStdinfo(a) = "cardno"
        Case 1
        strStdinfo(a) = "studentNo"
        Case 2
        strStdinfo(a) = "studentName"
        Case 3
        strStdinfo(a) = "sex"
        Case 4
        strStdinfo(a) = "department"
        Case 5
        strStdinfo(a) = "grade"
        Case 6
        strStdinfo(a) = "class"
    End Select
    Next a
    
            For b = 0 To 1
    Select Case Combo3(b).ListIndex                    ‘設定組合關係
        Case 0
        strRelationship(b) = "and"
        Case 1
        strRelationship(b) = "or"
    End Select
    Next b
    
    txtSQL = "select * from student_Info where "                   ’連線所需資料庫
    Set mrc = ExecuteSQL(txtSQL, MsgText)
   ' 第一行