急~~~寻求VB高手解决代码问题

来源:百度知道 编辑:UC知道 时间:2024/06/07 19:38:17
VB中的一个班级修改模块中,"修改"功能无法实现,发现不了哪里存在语法错误或缺少某语法,
下面是班级修改模块中的源代码:
Private Sub Command1_Click()
If admin = 1 Then
Dim myCon As New ADODB.Connection '连接数据库
Dim myRs As New ADODB.Recordset '操作数据
Dim NianJi, ZhuanYe, RenShu, FuDaoYuan, BeiZu As String
NianJi = Text1.Text
ZhuanYe = Text2.Text
RenShu = Text3.Text
FuDaoYuan = Text4.Text
BeiZu = Text5.Text
If Trim(NianJi) = "" Or Trim(ZhuanYe) = "" Or Trim(RenShu) = "" Or Trim(FuDaoYuan) = "" Then
MsgBox "请填写要修改班级资料的内容!"
Exit Sub
End If

myCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=信息.mdb;" '打开数据库
myRs.Open "select * from 班级表 where 年级='" & Text1.Text & "'", myCon, 3, 2
'myRs!年级 = Text1.Text
myRs!专业 = Text2.Text
myRs!人数 = Text3.Text
myRs!辅导员 = Text4.Text
If

1.
myCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=信息.mdb;" '打开数据库

好像是缺路径:data source= X:\XXXX\信息.mdb

2.myRs.Open "select * from 班级表 where 年级='" & Text1.Text & "'", myCon, 3, 2
改为:myCon, 1, 3

3.MsgBox "您确定要修改吗?", vbYesNo, "提示"

有问题,点Yes或NO程序怎么运行?
改为:
if MsgBox "您确定要修改吗?", vbYesNo, "提示"=vbyes then
Adodc1.RecordSource = "select * from 班级表 order by 年级
...
...
Text5.Text = ""
endif

4.'myRs!年级 = Text1.Text
myRs!专业 = Text2.Text
myRs!人数 = Text3.Text
myRs!辅导员 = Text4.Text
If Text5.Text = "" Then
Text5.Text = ""
Else
myRs!备注 = Text5.Text
这里也不对.
myrs.Fields("**")=***
......