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

📄 form4.frm

📁 很好的运行在vb6.0与sqlserver上,保证能够运行通过
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form4 
   Caption         =   "Form4"
   ClientHeight    =   7230
   ClientLeft      =   60
   ClientTop       =   510
   ClientWidth     =   6090
   LinkTopic       =   "Form4"
   ScaleHeight     =   7230
   ScaleWidth      =   6090
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "返回"
      Height          =   495
      Left            =   4680
      TabIndex        =   13
      Top             =   6000
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "保存"
      Height          =   495
      Left            =   4680
      TabIndex        =   12
      Top             =   5160
      Width           =   975
   End
   Begin VB.Frame Frame1 
      Caption         =   "输入信息"
      Height          =   6375
      Left            =   480
      TabIndex        =   0
      Top             =   480
      Width           =   3855
      Begin VB.TextBox Text6 
         Height          =   615
         Left            =   1560
         TabIndex        =   14
         Top             =   2400
         Width           =   1935
      End
      Begin VB.TextBox Text5 
         Height          =   495
         Left            =   1560
         TabIndex        =   11
         Top             =   5280
         Width           =   1815
      End
      Begin VB.TextBox Text4 
         Height          =   495
         Left            =   1560
         TabIndex        =   10
         Top             =   4440
         Width           =   1575
      End
      Begin VB.TextBox Text3 
         Height          =   495
         Left            =   1560
         TabIndex        =   9
         Top             =   3480
         Width           =   1695
      End
      Begin VB.TextBox Text2 
         Height          =   495
         Left            =   1560
         TabIndex        =   8
         Top             =   1440
         Width           =   2055
      End
      Begin VB.TextBox Text1 
         Height          =   495
         Left            =   1560
         TabIndex        =   7
         Top             =   600
         Width           =   1455
      End
      Begin VB.Label Label6 
         Caption         =   "电话"
         Height          =   735
         Left            =   120
         TabIndex        =   6
         Top             =   5400
         Width           =   1335
      End
      Begin VB.Label Label5 
         Caption         =   "所属院系"
         Height          =   615
         Left            =   120
         TabIndex        =   5
         Top             =   4440
         Width           =   1095
      End
      Begin VB.Label Label4 
         Caption         =   "年龄"
         Height          =   615
         Left            =   120
         TabIndex        =   4
         Top             =   3480
         Width           =   1215
      End
      Begin VB.Label Label3 
         Caption         =   "性别"
         Height          =   735
         Left            =   120
         TabIndex        =   3
         Top             =   2400
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "学生学号"
         Height          =   615
         Left            =   120
         TabIndex        =   2
         Top             =   1440
         Width           =   1095
      End
      Begin VB.Label Label1 
         Caption         =   "学生姓名"
         Height          =   495
         Left            =   120
         TabIndex        =   1
         Top             =   600
         Width           =   975
      End
   End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
Dim i As Integer
Set cn = New ADODB.Connection
cn.ConnectionString = "driver={sql server};server=FU;uid=sa;pwd=;database=sinformation"
cn.Open
Set rs = New ADODB.Recordset
rs.Open "select * from student", cn, adOpenDynamic, adLockOptimistic
If IsNumeric(Text3.Text) Then
  rs.AddNew
  rs.Fields(0) = Text1.Text
  rs.Fields(1) = Text2.Text
  rs.Fields(2) = Text6.Text
  rs.Fields(3) = Text3.Text
  rs.Fields(4) = Text4.Text
  rs.Fields(5) = Text5.Text
  rs.Update
  rs.Close
  MsgBox "学生信息添加成功", , "提示"
  If MsgBox("你是否还要添加该学生的成绩信息", vbYesNo, "提示") = vbYes Then
     Form7.Text1.Text = Text1.Text
     Form7.Text2.Text = Text2.Text
     Text1.Text = ""
     Text2.Text = ""
     Text3.Text = ""
     Text4.Text = ""
     Text5.Text = ""
     Text6.Text = ""
     Form4.Hide
     Form7.Show
  End If
Else
  MsgBox "请在年龄框内输入数字", , "警告"
  SendKeys "{home}+{end}"
End If
End Sub

Private Sub Command2_Click()
Form4.Hide
Form1.Show
End Sub

⌨️ 快捷键说明

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