[学生信息管理系统]之实时错误‘424’‘3021’‘-2147217887’

1、实时错误“424”




——解决方法:StatusBar1是状态栏控件的名称;Panels(1).Text表示状态栏上第1个空格所显示的文本内容
解决办法:
第一种办法:删除sbStatusBar.Panels(1).Text = "添加用户"或者将它注释掉(我选的第一种方法)
第二种办法:新建form取名sbStatusBar,然后在这个窗体上新建个文本框取名Panels,并且文本框属性index为1就可以了。
第三种方法:工程-部件-Microsoft Windows common controls6.0勾上。

2、实时错误“3021”

出现此错误是因为:
1.查找的数据库记录为空,可以用 rs.RecordCount 来判断数据是否等于0 
2.查找到数据后,用 Del 命令删除记录后再引用 Fields 后会出现错误
3.已经用MoveFirst 或用 MovePrevious 命令 移动至数据库开始后再用 MovePrevious 命令
4.已经用MoveLast 或用 MoveNext 命令 移动至数据库开始后再用 MoveNext 命令.
——解决方法:
原因:
txtSQL = “select * from user_Info ” ‘从student表的密码表user_info中选择 
Set mrc = ExecuteSQL(txtSQL, MsgText) 
mrc.Fields(1) = Text1.Text ‘从第二列user PWD赋值 

3、实时错误‘-2147217887’
原因:大多数是输入的数据违反了数据库的约束条件、字段大小超过限制提交的数据个数、字段数据类型不匹配、自动编号指定了值、或者自动编号未作自动赋值、字段不允许为空值等。
me:我在联系电话那里输入了11位数字,但范围只能是10位内的数字,不然就出现了  实时错误-2147217887,我仔细找了原因,发现原来是数据库的问题,数据库的值tele_number设定的数值类型是char(10)。
char(10)可以存储的长度是10个字节,是一个固定长度的非unicode字符数据,输入的字符少于10,与空格填满。超出的截除,在vb中就出现了 实时错误-2147217887。
所以我们只要重新修改数据库的tele_number设定的数值类型是char(10)为插入char(11).如图所示:
——解决方法

vb实时错误3021

04-29

请帮我看看代码错哪里?挺乱的rnrn Public combo As StringrnrnPrivate Sub Command1_Click(Index As Integer)rn Dim ConStr As Stringrn Dim cn As Connectionrn Dim rs As Recordsetrn Dim rs1 As Recordsetrn Dim rs2 As Recordsetrn Dim rs3 As Recordsetrn rn Set cn = New ADODB.Connectionrn Set rs = New ADODB.Recordsetrn Set rs1 = New ADODB.Recordsetrn Set rs2 = New ADODB.Recordsetrn Set rs3 = New ADODB.Recordsetrn ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\ttj02.Mdb"rn cn.Open ConStrrn cn.CursorLocation = adUseClientrn rs.Open "Select * from zhuti", cn, adOpenStatic, adLockReadOnlyrn rs1.Open "Select * from keti", cn, adOpenStatic, adLockReadOnlyrn Dim s, o, level1, level2, depart1, depart2 As Stringrn s = frmlogin.UserTypern o = comborn rn rs2.Open "Select * From zhuti Where zhiwu= '" & s & "'", cn, adOpenStatic, adLockReadOnlyrn rs3.Open "Select * From keti Where ziliao= '" & o & "'", cn, adOpenStatic, adLockReadOnlyrn 'level1 = "SELECT * FROM zhuti WHERE zhiwu='" & s & "'"rn 'level2 = "SELECT * FROM keti WHERE zhiliao='" & o & "'"rn rn level1 = rs2("degree1")rn level2 = rs3("degree1")rn depart1 = rs2("bumen1")rn depart2 = rs3("bumen1")rn Do While Not rs.EOFrnrn If depart1 <> depart2 Thenrn MsgBox "你没有权限!", vbExclamation + vbOKCancel, "错误"rn ElseIf level1 < level2 Thenrn MsgBox "你没有权限!", vbExclamation + vbOKCancel, "错误"rn rn rn If level1 >= level2 Thenrn MsgBox "你有权限!", vbExclamation + vbOKCancel, "提示"rn Form2.Showrn Unload Mernrnrn Exit Subrn End Ifrn End Ifrn Looprn rs.Closern rs1.Closern rs2.Closern rs3.Closern Set rs = NothingrnSet rs1 = NothingrnSet rs2 = NothingrnSet rs3 = NothingrnrnEnd SubrnrnrnPrivate Sub Command2_Click(Index As Integer)rnDim ConStr As Stringrn Dim cn As Connectionrn Dim rs As Recordsetrn Dim rs1 As Recordsetrn Dim rs2 As Recordsetrn Dim rs3 As Recordsetrn rn Set cn = New ADODB.Connectionrn Set rs = New ADODB.Recordsetrn Set rs1 = New ADODB.Recordsetrn Set rs2 = New ADODB.Recordsetrn Set rs3 = New ADODB.Recordsetrn ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\ttj02.Mdb"rn cn.Open ConStrrn cn.CursorLocation = adUseServerrn rs.Open "Select * from zhuti", cn, adOpenStatic, adLockReadOnlyrn rs1.Open "Select * from keti", cn, adOpenStatic, adLockReadOnlyrn Dim s, o, level1, level2 As Stringrn s = frmlogin.UserTypern o = Form1.comborn rn rs2.Open "Select * From zhuti Where zhiwu= '" & s & "'", cn, adOpenStatic, adLockReadOnlyrn rs3.Open "Select * From keti Where ziliao= '" & o & "'", cn, adOpenStatic, adLockReadOnlyrn 'level1 = "SELECT * FROM zhuti WHERE zhiwu='" & s & "'"rn 'level2 = "SELECT * FROM keti WHERE zhiliao='" & o & "'"rn rn level1 = rs2("degree1")rn level2 = rs3("degree1")rn depart1 = rs2("bumen1")rn depart2 = rs3("bumen1")rn Do While Not rs.EOFrnrn If depart1 <> depart2 Thenrn MsgBox "你没有权限!", vbExclamation + vbOKCancel, "错误"rn ElseIf level2 < level1 Thenrn MsgBox "你没有权限!", vbExclamation + vbOKCancel, "错误"rn rn rn If level2 >= level1 Thenrn MsgBox "你有权限!", vbExclamation + vbOKCancel, "提示"rn Form2.Showrn Unload Mernrnrn Exit Subrn End Ifrn End Ifrn Looprn rs.Closern rs1.Closern rs2.Closern rs3.Closern Set rs = NothingrnSet rs1 = NothingrnSet rs2 = NothingrnSet rs3 = NothingrnrnEnd SubrnrnPrivate Sub Form_Load()rnWith Combo2(0)rnrnrn .AddItem "生产部交总经理资料"rn .AddItem "生产部交经理资料"rn .AddItem "生产部交主管资料"rn .AddItem "生产部一般资料"rn rn End WithrnrnWith Combo3(1)rnrnrn .AddItem "销售部交总经理资料"rn .AddItem "销售部交经理资料"rn .AddItem "销售部交主管资料"rn .AddItem "销售部一般资料"rn rn End WithrnWith Combo4(2)rnrnrn .AddItem "采购部交总经理资料"rn .AddItem "采购部交经理资料"rn .AddItem "采购部交主管资料"rn .AddItem "采购部一般资料"rn rnEnd WithrnWith Combo5(3)rnrnrn .AddItem "生产部交总经理资料"rn .AddItem "生产部交经理资料"rn .AddItem "生产部交主管资料"rn .AddItem "生产部一般资料"rn rn End Withrnrn combo = Left(Combo2(0).Text, 12)rn combo = Left(Combo3(1).Text, 12)rn combo = Left(Combo4(2).Text, 12)rn combo = Left(Combo5(3).Text, 12)rn rnEnd Subrn错误字段:level2 = rs3("degree1")rnrndepart2 = rs3("bumen1") rn

实时错误,424

11-03

请各位高手帮我检查一下我的下段代码,错误在那里,请指出,不胜感谢.(刚加入,没多少分,请不要见怪)rn我的目的是,利用VB,将数据库E中的表t_voucher的数据复制添加到数据库C中的表t_voucher,两表的结构属性字段都完全相同.rn执行时报错:实时错误,424,要求对象.rnPrivate Sub Command1_Click()rnDim cn1rnDim cn2rnDim rs1rnDim rs2rnSet cn1 = New ADODB.Connectionrncn1.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=E;Data Source=server"rnSet cn2 = New ADODB.Connectionrncn2.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=c;Data Source=server"rn'Set rs1 = cn1.Execute("select * from e.dbo.t_voucher")rnrs1.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=E;Data Source=server"rn'Set rs2 = cn2.Execute("select * from c.dbo.t_voucher")rnrs2.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=c;Data Source=server"rnrs1.MoveFirstrnWhile Not rs1.EOFrnrs2.AddNewrnrs2(1).Value = rs1(1).Valuernrs2(2).Value = rs1(2).Valuernrs2(3).Value = rs1(3).Valuernrs2(4).Value = rs1(4).Valuernrs2(5).Value = rs1(5).Valuernrs2(6).Value = rs1(6).Valuernrs2(7).Value = rs1(7).Valuernrs2(8).Value = rs1(8).Valuernrs2(9).Value = rs1(9).Valuernrs2(10).Value = rs1(10).Valuernrs2(11).Value = rs1(11).Valuernrs2(12).Value = rs1(12).Valuernrs2(13).Value = rs1(13).Valuernrs2(14).Value = rs1(14).Valuernrs2(15).Value = rs1(15).Valuernrs2(16).Value = rs1(16).Valuernrs2(17).Value = rs1(17).Valuernrs2(18).Value = rs1(18).Valuernrs2(19).Value = rs1(19).Valuernrs2(20).Value = rs1(20).Valuernrs2(21).Value = rs1(21).Valuernrs2(22).Value = rs1(22).Valuernrs2(23).Value = rs1(23).Valuernrs2(24).Value = rs1(24).Valuernrs2(25).Value = rs1(25).Valuernrs2(26).Value = rs1(26).Valuernrs2(27).Value = rs1(27).Valuernrs2(28).Value = rs1(28).Valuernrs2(29).Value = rs1(29).Valuernrs2(30).Value = rs1(30).Valuernrs2(31).Value = rs1(31).Valuernrs2.Updaternrs1.MoveNextrnWendrnrs1.Closernrs2.Closerncn1.Closerncn2.ClosernrnSet rs1 = NothingrnSet rs2 = NothingrnSet cn1 = NothingrnSet cn2 = NothingrnEnd Subrnrn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试

关闭