【VB开源代码栏目提醒】:本文主要为网学会员提供frmAccrual.frm,希望对需要frmAccrual.frm网友有所帮助,学习一下!
VERSION 5.00
Begin VB.Form frmAccrual
BackColor = &H00FF8080&
BorderStyle = 1 'Fixed Single
Caption = "存储利率调整"
ClientHeight = 3840
ClientLeft = 45
ClientTop = 435
ClientWidth = 4275
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3840
ScaleWidth = 4275
Begin VB.CommandButton cmdClose
Cancel = -1 'True
Caption = "关 闭"
Height = 345
Left = 2640
TabIndex = 9
Top = 3240
Width = 975
End
Begin VB.CommandButton cmdUpdate
Caption = "修 改"
Height = 345
Left = 240
TabIndex = 8
Top = 3240
Width = 975
End
Begin VB.CommandButton cmdSave
Caption = "保 存"
Default = -1 'True
Enabled = 0 'False
Height = 345
Left = 1560
TabIndex = 7
Top = 3240
Width = 975
End
Begin VB.TextBox txt
Enabled = 0 'False
Height = 270
Index = 8
Left = 1200
TabIndex = 6
Top = 2760
Width = 2175
End
Begin VB.TextBox txt
Enabled = 0 'False
Height = 270
Index = 5
Left = 1200
TabIndex = 5
Top = 2280
Width = 2175
End
Begin VB.TextBox txt
Enabled = 0 'False
Height = 270
Index = 3
Left = 1200
TabIndex = 4
Top = 1800
Width = 2175
End
Begin VB.TextBox txt
Enabled = 0 'False
Height = 270
Index = 2
Left = 1200
TabIndex = 3
Top = 1320
Width = 2175
End
Begin VB.TextBox txt
Enabled = 0 'False
Height = 270
Index = 1
Left = 1200
TabIndex = 2
Top = 840
Width = 2175
End
Begin VB.TextBox txt
Enabled = 0 'False
Height = 270
Index = 0
Left = 1200
TabIndex = 1
Top = 360
Width = 2175
End
Begin
VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "八年:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 1
Left = 600
TabIndex = 14
Top = 2880
Width = 540
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "三年:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 5
Left = 600
TabIndex = 13
Top = 1920
Width = 540
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "五年:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 4
Left = 600
TabIndex = 12
Top = 2400
Width = 540
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "一年:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 3
Left = 600
TabIndex = 11
Top = 960
Width = 540
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "二年:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 2
Left = 600
TabIndex = 10
Top = 1440
Width = 540
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "活期:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 0
Left = 600
TabIndex = 0
Top = 480
Width = 540
End
End
Attribute VB_Name = "frmAccrual"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'响应 "关闭" 按钮
Private Sub cmdClose_Click()
Unload Me
End Sub
'响应 "保存" 按钮
Private Sub cmdSave_Click()
'判断用户的输入是否为数字
'定义存储存款年利率的临时变量theAccrual
Dim theAccrual As Double
Dim accrualDouble As Boolean
accrualDouble = False
On Error GoTo err1
'依次判断输入的年储蓄利率是否包含非数字
For i = 0 To 3
theAccrual = CDbl(txt(i).Text)
Next i
theAccrual = CDbl(txt(5).Text)
theAccrual = CDbl(txt(8).Text)
accrualDouble = True
err1:
If Not accrualDouble Then
'输入的年储蓄利率包含非数字,弹出错误提示
MsgBox "请确定你所输入的是数字!"
Exit Sub
End If
'定义数据集对象rst
Dim rst As New Recordset
'调用LinkDB函数设置
登陆数据库服务器时的身份验证方式
Call LinkDB(landWay, SName, "yinhang", SUName, SUPw)
'连接数据库yinhang
con.Open
Dim errGet As Boolean
errGet = True
On Error GoTo errGoto
'重新设置数据集对象rst,以返回accrual表中的所有年储蓄利率
rst.Open "select * from accrual", con, adOpenDynamic, adLockOpti
mistic
rst.MoveFirst
rst.Close
errGet = False
errGoto:
If errGet Then
'accrual表中的年储蓄利率表有问题,直接执行sql语句,在accrual表中插入输入的年储蓄利率
con.Execute "insert accrual values('0','" & CDbl(txt(0).Text) & "')"
con.Execute "insert accrual values('1','" & CDbl(txt(1).Text) & "')"
con.Execute "insert accrual values('2','" & CDbl(txt(2).Text) & "')"
con.Execute "insert accrual values('3','" & CDbl(txt(3).Text) & "')"
con.Execute "insert accrual values('5','" & CDbl(txt(5).Text) & "')"
con.Execute "insert accrual values('8','" & CDbl(txt(8).Text) & "')"
Else
'accrual表中的年储蓄利率表有
问题,直接执行
sql语句,在accrual表中更新年储蓄利率表
con.Execute "update accrual set percentage=" & CDbl(txt(0).Text) & " where theYear='0'"
con.Execute "update ac