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

📄 form1.frm

📁 VB连接SQL实例,对初学者很有帮助,帮助大大滴有
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form1 
   Caption         =   "判断T_STUDENT表中学生的性别"
   ClientHeight    =   3375
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5220
   LinkTopic       =   "Form1"
   ScaleHeight     =   3375
   ScaleWidth      =   5220
   StartUpPosition =   2  '屏幕中心
   Begin VB.CheckBox ChkWoman 
      Caption         =   "女"
      Height          =   375
      Left            =   1320
      TabIndex        =   3
      Top             =   1320
      Width           =   1095
   End
   Begin VB.TextBox TxtName 
      DataField       =   "t_s_name"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1320
      TabIndex        =   2
      Top             =   120
      Width           =   3015
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   240
      Top             =   2760
      Width           =   2535
      _ExtentX        =   4471
      _ExtentY        =   661
      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=db_student;Data Source=mynetserver"
      OLEDBString     =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=db_student;Data Source=mynetserver"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "t_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.CommandButton Command2 
      Caption         =   "退出"
      Height          =   375
      Left            =   3360
      TabIndex        =   1
      Top             =   2760
      Width           =   1695
   End
   Begin VB.CheckBox ChkMan 
      Caption         =   "男"
      Height          =   495
      Left            =   1320
      TabIndex        =   0
      Top             =   720
      Width           =   3255
   End
   Begin VB.Label Label1 
      Caption         =   "性别:"
      Height          =   375
      Left            =   480
      TabIndex        =   5
      Top             =   840
      Width           =   615
   End
   Begin VB.Label LblName 
      Caption         =   "姓名:"
      Height          =   375
      Left            =   480
      TabIndex        =   4
      Top             =   240
      Width           =   855
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'当ADODC1的记录集移动时的处理代码
Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
 '判断记录集是否在头部和尾部,防止出现超出记录集范围的错误
 If Adodc1.Recordset.EOF = False And Adodc1.Recordset.BOF = False Then
   '提取T_STUDENT表中T_S_SEX字段的值进行判断
   If Adodc1.Recordset.Fields(2) = "男" Then
     '如果是性别为男,则将ChkMan这个对象选择
     ChkMan.Value = 1
     ChkWoman.Value = 0
   Else
     ChkMan.Value = 0
     ChkWoman.Value = 1
   End If
 End If
End Sub
'单击该按钮退出
Private Sub Command2_Click()
  Unload Me
End Sub

⌨️ 快捷键说明

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