问题描述
如题 代码如下:PrivateSubCommand1_Click()IfText1.Text=""ThenMsgBox"年度不能为空!",vbOKOnly+vbExclamation,"警告"ExitSubEndIfSetadoPrimaryRS=NewADODB.Recordseta=Text1.TextadoPrimaryRS.Open"select*fromgzpjinfowhere年度='"&a&"'",db,adOpenStatic,adLockOptimistic ↑上面语句为报错语句IfadoPrimaryRS.EOFThenSetadoPrimaryRS1=NewADODB.RecordsetadoPrimaryRS1.Open"select*fromygInfo",db,adOpenStatic,adLockOptimisticadoPrimaryRS1.MoveFirstDoWhileNotadoPrimaryRS1.EOFadoPrimaryRS.AddNewadoPrimaryRS.Fields("员工编号")=adoPrimaryRS1.Fields("员工编号")adoPrimaryRS.Fields("考核等级")="合格"adoPrimaryRS.Fields("备注")="无"adoPrimaryRS.Fields("年度")=aadoPrimaryRS1.MoveNextLoopadoPrimaryRS.UpdateElseMsgBox"该年的考核评价表已经创建,确认开始浏览!",vbOKOnly+vbExclamation,"警告"EndIfadoPrimaryRS.CloseadoPrimaryRS.Open"selectgzpjinfo.员工编号,mang.姓名,gzpjinfo.考核等级,gzpjinfo.年度,gzpjinfo.备注fromgzpjinfo,mangwheregzpjinfo.员工编号=yginfo.员工编号andgzpjinfo.年度='"&a&"'",db,adOpenStatic,adLockOptimisticWithmyFlexGrid.Rows=2.CellAlignment=4.TextMatrix(1,0)="员工编号".TextMatrix(1,1)="姓名".TextMatrix(1,2)="考核等级".TextMatrix(1,3)="年度".TextMatrix(1,4)="备注"adoPrimaryRS.MoveFirstDoWhileNotadoPrimaryRS.EOF.Rows=.Rows+1.CellAlignment=4Forj=0ToadoPrimaryRS.Fields.Count-1.TextMatrix(.Rows-1,j)=adoPrimaryRS.Fields(j)NextjadoPrimaryRS.MoveNextLoopEndWithCommand3.Enabled=TrueEndSub
解决方案
解决方案二:
各位高手帮帮忙啊.!
解决方案三:
VB6的代码?去VB6的板块问问吧创建一个新的实例看看另外,不要用SetPS:.NET的数据库访问也变成ADO.NET,放弃ADO吧