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

📄 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表中T_S_SEX字段的值"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Caption         =   "退出"
      Height          =   375
      Left            =   3120
      TabIndex        =   3
      Top             =   2400
      Width           =   1335
   End
   Begin VB.TextBox TxtName 
      DataField       =   "t_s_name"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   960
      TabIndex        =   2
      Top             =   120
      Width           =   2655
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   240
      Top             =   2400
      Width           =   2655
      _ExtentX        =   4683
      _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.OptionButton OptWoman 
      Caption         =   "女"
      Height          =   375
      Left            =   1080
      TabIndex        =   1
      Top             =   1440
      Width           =   1575
   End
   Begin VB.OptionButton OptMan 
      Caption         =   "男"
      Height          =   375
      Left            =   1080
      TabIndex        =   0
      Top             =   960
      Width           =   1455
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'在移动adodc的记录集时产生的事件代码
Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
'当ADODC1的记录集移动时的处理代码
 '判断记录集是否在头部和尾部,防止出现超出记录集范围的错误
 If Adodc1.Recordset.EOF = False And Adodc1.Recordset.BOF = False Then
   '提取T_STUDENT表中T_S_SEX字段的值进行判断
   If Adodc1.Recordset.Fields(2) = "男" Then
     '如果是性别为男,则将OptMan这个对象选择
     OptMan.Value = True
     OptWoman.Value = False
   Else
     OptMan.Value = False
     OptWoman.Value = True
   End If
 End If
End Sub



'单击该按钮退出
Private Sub Command1_Click()
  Unload Me
End Sub


⌨️ 快捷键说明

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