在VB6.0中,麻烦大神解释下面代码的含义?具体点可好?
PrivateSubBtn_Update_Click()DimbookTypeRsAsADODB.RecordsetCallcheck_condatabaseSql="s...
Private Sub Btn_Update_Click()
Dim bookTypeRs As ADODB.Recordset
Call check_condatabase
Sql = "select * from BookType where bookTypeId=" & Me.TB_bookTypeId.Text
Set bookTypeRs = New ADODB.Recordset
Set bookTypeRs.ActiveConnection = cn
bookTypeRs.LockType = adLockOptimistic
bookTypeRs.CursorType = adOpenKeyse
bookTypeRs.Open Sql
bookTypeRs("bookTypeName") = Me.TB_bookTypeName.Text
On Error GoTo daysError:
bookTypeRs("days") = CInt(Me.TB_days.Text)
GoTo daysOK
daysError:
MsgBox "可借阅天数输入格式不正确!", vbInformation, "信息提示"
Me.TB_days.SetFocus
GoTo EndSub
daysOK:
bookTypeRs.Update
MsgBox "图书类型更新成功!"
Unload Me
EndSub:
End Sub 展开
Dim bookTypeRs As ADODB.Recordset
Call check_condatabase
Sql = "select * from BookType where bookTypeId=" & Me.TB_bookTypeId.Text
Set bookTypeRs = New ADODB.Recordset
Set bookTypeRs.ActiveConnection = cn
bookTypeRs.LockType = adLockOptimistic
bookTypeRs.CursorType = adOpenKeyse
bookTypeRs.Open Sql
bookTypeRs("bookTypeName") = Me.TB_bookTypeName.Text
On Error GoTo daysError:
bookTypeRs("days") = CInt(Me.TB_days.Text)
GoTo daysOK
daysError:
MsgBox "可借阅天数输入格式不正确!", vbInformation, "信息提示"
Me.TB_days.SetFocus
GoTo EndSub
daysOK:
bookTypeRs.Update
MsgBox "图书类型更新成功!"
Unload Me
EndSub:
End Sub 展开
展开全部
Private Sub Btn_Update_Click()
Dim bookTypeRs As ADODB.Recordset '定义一个记录集
Call check_condatabase ‘调用数据库访问函数
Sql = "select * from BookType where bookTypeId=" & Me.TB_bookTypeId.Text ’查询SQl语句
Set bookTypeRs = New ADODB.Recordset ‘重新定义一个新的记录集
Set bookTypeRs.ActiveConnection = cn ’绑定数据库链接
bookTypeRs.LockType = adLockOptimistic'访问权限设置
bookTypeRs.CursorType = adOpenKeyse
bookTypeRs.Open Sql ’执行查询
bookTypeRs("bookTypeName") = Me.TB_bookTypeName.Text
On Error GoTo daysError: ‘定义异常标签
bookTypeRs("days") = CInt(Me.TB_days.Text) 把天数文本框内容赋值给days列
GoTo daysOK ‘定义异常标签
daysError: ’标签 如果出错跳转到指定标签 daysError
MsgBox "可借阅天数输入格式不正确!", vbInformation, "信息提示"
Me.TB_days.SetFocus
GoTo End Sub
daysOK:‘标签
bookTypeRs.Update
MsgBox "图书类型更新成功!"
Unload Me
EndSub:’标签
End Sub
Dim bookTypeRs As ADODB.Recordset '定义一个记录集
Call check_condatabase ‘调用数据库访问函数
Sql = "select * from BookType where bookTypeId=" & Me.TB_bookTypeId.Text ’查询SQl语句
Set bookTypeRs = New ADODB.Recordset ‘重新定义一个新的记录集
Set bookTypeRs.ActiveConnection = cn ’绑定数据库链接
bookTypeRs.LockType = adLockOptimistic'访问权限设置
bookTypeRs.CursorType = adOpenKeyse
bookTypeRs.Open Sql ’执行查询
bookTypeRs("bookTypeName") = Me.TB_bookTypeName.Text
On Error GoTo daysError: ‘定义异常标签
bookTypeRs("days") = CInt(Me.TB_days.Text) 把天数文本框内容赋值给days列
GoTo daysOK ‘定义异常标签
daysError: ’标签 如果出错跳转到指定标签 daysError
MsgBox "可借阅天数输入格式不正确!", vbInformation, "信息提示"
Me.TB_days.SetFocus
GoTo End Sub
daysOK:‘标签
bookTypeRs.Update
MsgBox "图书类型更新成功!"
Unload Me
EndSub:’标签
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询