frmcardaddvalue.frm
来自「数据库管理系统的实习内容」· FRM 代码 · 共 326 行
FRM
326 行
VERSION 5.00
Begin VB.Form frmCardaddvalue
BorderStyle = 1 'Fixed Single
Caption = "一卡通充值操作"
ClientHeight = 4575
ClientLeft = 45
ClientTop = 435
ClientWidth = 5760
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
Picture = "frmCardaddvalue.frx":0000
ScaleHeight = 4575
ScaleWidth = 5760
Begin VB.CommandButton Command1
Caption = "确认卡值"
Height = 375
Left = 4440
TabIndex = 14
Top = 2400
Width = 1095
End
Begin VB.ComboBox comboType
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1440
TabIndex = 7
Top = 2760
Width = 2175
End
Begin VB.CommandButton cmdCancel
Caption = "退出(&X)"
Height = 375
Left = 4440
TabIndex = 6
Top = 3840
Width = 1095
End
Begin VB.CommandButton cmdRefresh
Caption = "刷新(&R)"
Height = 375
Left = 4440
TabIndex = 5
Top = 3120
Width = 1095
End
Begin VB.CommandButton cmdOK
Caption = "确定(&O)"
Height = 375
Left = 4440
TabIndex = 4
Top = 1680
Width = 1095
End
Begin VB.TextBox txtChongdate
Height = 375
Left = 1440
TabIndex = 3
Top = 2040
Width = 2055
End
Begin VB.TextBox txtCardvalue
Height = 375
Left = 1440
TabIndex = 2
Top = 3480
Width = 2055
End
Begin VB.TextBox txtAddvalue
Height = 375
Left = 1440
TabIndex = 1
Top = 1320
Width = 2055
End
Begin VB.TextBox txtCardno
Height = 375
Left = 1440
TabIndex = 0
Top = 600
Width = 2055
End
Begin VB.Frame Frame1
Caption = "充值信息"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4335
Left = 0
TabIndex = 8
Top = 0
Width = 4215
Begin VB.Label Label1
Caption = "卡号"
Height = 375
Left = 480
TabIndex = 13
Top = 600
Width = 1095
End
Begin VB.Label Label2
Caption = "充值金额"
Height = 375
Left = 480
TabIndex = 12
Top = 1320
Width = 975
End
Begin VB.Label Label3
Caption = "现有金额"
Height = 375
Left = 480
TabIndex = 11
Top = 3600
Width = 975
End
Begin VB.Label Label4
Caption = "充值日期"
Height = 495
Left = 480
TabIndex = 10
Top = 2040
Width = 975
End
Begin VB.Label Label5
Caption = "充值类型"
Height = 375
Left = 480
TabIndex = 9
Top = 2760
Width = 855
End
End
End
Attribute VB_Name = "frmCardaddvalue"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim txtSQL As String
If Not Testtxt(txtCardno.Text) Then
MsgBox "请输入卡号!", vbOKOnly + vbExclamation, "提示您"
txtCardno.SetFocus
Exit Sub
End If
If Not IsNumeric(Trim(txtCardno.Text)) Then
MsgBox "请输入数字!", vbOKOnly + vbExclamation, "提示您"
Exit Sub
txtCardno.SetFocus
End If
If Not Testtxt(txtAddvalue.Text) Then
MsgBox "请输入卡号!", vbOKOnly + vbExclamation, "提示您"
txtAddvalue.SetFocus
Exit Sub
End If
If Not IsNumeric(Trim(txtAddvalue.Text)) Then
MsgBox "请输入数字!", vbOKOnly + vbExclamation, "提示您"
Exit Sub
txtAddvalue.SetFocus
End If
If Not Testtxt(txtChongdate.Text) Then
MsgBox "请输入充值日期!", vbOKOnly + vbExclamation, "提示您"
txtChongdate.SetFocus
Exit Sub
End If
If Not IsDate(txtChongdate.Text) Then
MsgBox "出生时间应输入日期格式(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
txtChongdate.SetFocus
Else
txtChongdate = Format(txtChongdate, "yyyy-mm-dd")
End If
txtSQL = "select * from card_Info where card_ID='" & Trim(txtCardno) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "您的一卡通没有注册!", vbOKOnly + vbExclamation, "警告"
txtCardno.SetFocus
txtCardno.Text = ""
txtCardno.SelStart = 0
txtCardno.SelLength = Len(txtCardno)
Exit Sub
End If
mrc.Close
txtSQL = "select * from hang_Info where card_ID='" & Trim(txtCardno) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
MsgBox "您的一卡通已经挂失,无法充值!", vbOKOnly + vbExclamation, "提示"
txtCardno.SetFocus
txtCardno.Text = ""
txtCardno.SelStart = 0
txtCardno.SelLength = Len(txtCardno)
Exit Sub
End If
mrc.Close
txtSQL = "select * from account_Info "
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(txtCardno.Text)
mrc.Fields(1) = Trim(txtAddvalue.Text)
mrc.Fields(2) = Trim(txtChongdate.Text)
mrc.Fields(3) = Trim(comboType.Text)
mrc.Update
mrc.Close
MsgBox "充卡成功,请确认卡值!", vbOKOnly + vbExclamation, "恭喜"
End Sub
Private Sub cmdRefresh_Click()
txtCardno.Text = ""
txtAddvalue.Text = ""
txtChongdate.Text = ""
txtCardvalue.Text = ""
End Sub
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim txtSQL As String
Dim value As Integer
Dim schoolNo As Integer
If Not Testtxt(txtCardno.Text) Then
MsgBox "请输入卡号!", vbOKOnly + vbExclamation, "提示您"
txtCardno.SetFocus
Exit Sub
End If
If Not IsNumeric(Trim(txtCardno.Text)) Then
MsgBox "请输入数字!", vbOKOnly + vbExclamation, "提示您"
Exit Sub
txtCardno.SetFocus
End If
txtSQL = "select * from hang_Info where card_ID='" & Trim(txtCardno) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
MsgBox "您的一卡通已经挂失,无法充值!", vbOKOnly + vbExclamation, "提示"
txtCardno.SetFocus
txtCardno.Text = ""
txtCardno.SelStart = 0
txtCardno.SelLength = Len(txtCardno)
Exit Sub
End If
mrc.Close
txtSQL = "select * from card_Info where card_ID='" & Trim(txtCardno) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = True Then
MsgBox "您的一卡通没有注册!", vbOKOnly + vbExclamation, "警告"
txtCardno.SetFocus
txtCardno.Text = ""
txtCardno.SelStart = 0
txtCardno.SelLength = Len(txtCardno)
Exit Sub
End If
If Not Testtxt(txtAddvalue.Text) Then
txtCardvalue.Text = mrc.Fields(2)
Else
value = mrc.Fields(2) + CDbl(txtAddvalue)
txtCardvalue.Text = value
schoolNo = mrc.Fields(1)
mrc.Delete
mrc.AddNew
mrc.Fields(0) = txtCardno.Text
mrc.Fields(1) = schoolNo
mrc.Fields(2) = value
mrc.Update
mrc.Close
End If
End Sub
Private Sub Form_Load()
Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
Dim i As Integer
comboType.Text = "充值"
comboType.Enabled = False
txtCardvalue.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?