⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 1.掌握SQL Server数据库系统SQL数据定义语言的使用方法 2.掌握SQL Server数据库系统SQL查询语言的使用方法 3.了解ADO数据控件与SQL Server的连接方式 4.用
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "Msadodc.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Form1 
   Caption         =   "简单的SQL查询(1)"
   ClientHeight    =   5430
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   8760
   LinkTopic       =   "Form1"
   ScaleHeight     =   5430
   ScaleWidth      =   8760
   StartUpPosition =   3  '窗口缺省
   Begin MSAdodcLib.Adodc Adodc2 
      Height          =   615
      Left            =   6480
      Top             =   1680
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   1085
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=jiaoxueguanli1;Data Source=pc587"
      OLEDBString     =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=jiaoxueguanli1;Data Source=pc587"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "Student"
      Caption         =   "Adodc2"
      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 MSAdodcLib.Adodc Adodc1 
      Height          =   615
      Left            =   6480
      Top             =   840
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   1085
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=jiaoxueguanli1;Data Source=pc587"
      OLEDBString     =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=jiaoxueguanli1;Data Source=pc587"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   "Sa"
      Password        =   ""
      RecordSource    =   "Student"
      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 
      Height          =   495
      Left            =   1920
      TabIndex        =   8
      Top             =   4680
      Width           =   975
   End
   Begin VB.CheckBox Check1 
      Caption         =   "显示记录"
      Height          =   495
      Left            =   240
      TabIndex        =   7
      Top             =   4680
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   495
      Left            =   6960
      TabIndex        =   6
      Top             =   3840
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查询"
      Height          =   495
      Left            =   6960
      TabIndex        =   5
      Top             =   3120
      Width           =   975
   End
   Begin VB.Frame Frame1 
      Caption         =   "查询方式"
      Height          =   1455
      Left            =   0
      TabIndex        =   1
      Top             =   3000
      Width           =   6495
      Begin VB.OptionButton Op1 
         Caption         =   "性别"
         Height          =   255
         Index           =   2
         Left            =   3240
         TabIndex        =   4
         Top             =   600
         Width           =   735
      End
      Begin VB.OptionButton Op1 
         Caption         =   "学号"
         Height          =   255
         Index           =   1
         Left            =   1800
         TabIndex        =   3
         Top             =   600
         Width           =   735
      End
      Begin VB.OptionButton Op1 
         Caption         =   "系"
         Height          =   255
         Index           =   0
         Left            =   480
         TabIndex        =   2
         Top             =   600
         Width           =   615
      End
   End
   Begin MSDataGridLib.DataGrid DataGrid1 
      Bindings        =   "Form1.frx":0000
      Height          =   2655
      Left            =   0
      TabIndex        =   0
      Top             =   120
      Width           =   9255
      _ExtentX        =   16325
      _ExtentY        =   4683
      _Version        =   393216
      HeadLines       =   1
      RowHeight       =   15
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public sqlstr As String, sqlstr1 As String, sqlstr2 As String

Private Sub Check1_Click()
If Check1.Value Then
   Adodc1.CommandType = adCmdText
   sqlstr = "select count(*) as 总人数 from student" + aqlstr2
   Adodc2.RecordSource = sqlstr
   Adodc2.Refresh
   Text1.DataField = "总人数"
Else
   Text1.DataField = ""
   Text1.Text = ""
End If
End Sub

Private Sub Command1_Click()
  Text1.DataField = ""
  Text1.Text = ""
  Check1.Value = False
  Adodc1.CommandType = adCmdText
  i = 0
  Do While Not Op1(i)
    i = i + 1
  Loop
  cond1 = Op1(i).Caption
  If cond1 = "系" Then condstr1 = "sdept"
  If cond1 = "学号" Then condstr1 = "sno"
  If cond1 = "性别" Then condstr1 = "ssex"
  str1 = InputBox("请输入" + cond1, "提示信息")
  If Len(str1) <> 0 Then
   sqlstr1 = "select sno as 学号,sname as 姓名," & " ssex as 性别, sage as 年龄, sdept as 系别    from student  "
  sqlstr2 = "where  " + condstr1 + "='" + str1 + "'"
     sqlstr = sqlstr1 + sqlstr2
     MsgBox sqlstr
  Adodc1.RecordSource = sqlsrt
  Adodc1.Refresh
End If
End Sub

Private Sub Command2_Click()
End
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -