见程序: Adodc3.CommandType = adCmdText
Adodc3.RecordSource = "select * from setc where 141000<=userno and userno>=142999 order by userno"
Adodc3.Refresh
Adodc1.Recordset.MoveFirst
Do While Not Adodc1.Recordset.EOF
Adodc3.Recordset.AddNew
Text3(0).Text = Text1(0).Text
Text3(1).Text = Val(Text1(3).Text) + Val(Text1(5).Text)
Text3(2).Text = Val(Text1(4).Text) + Val(Text1(6).Text)
Adodc3.Recordset.Fields("tottc") = 0 '问题出现(开始几条记录没有问题)
Adodc3.Recordset.Update
Adodc1.Recordset.MoveNext
Loop
Adodc3.RecordSource = "select * from setc where 141000<=userno and userno>=142999 order by userno"
Adodc3.Refresh
Adodc1.Recordset.MoveFirst
Do While Not Adodc1.Recordset.EOF
Adodc3.Recordset.AddNew
Text3(0).Text = Text1(0).Text
Text3(1).Text = Val(Text1(3).Text) + Val(Text1(5).Text)
Text3(2).Text = Val(Text1(4).Text) + Val(Text1(6).Text)
Adodc3.Recordset.Fields("tottc") = 0 '问题出现(开始几条记录没有问题)
Adodc3.Recordset.Update
Adodc1.Recordset.MoveNext
Loop
Text3(1).Text = Val(Text1(3).Text) + Val(Text1(5).Text)
Text3(2).Text = Val(Text1(4).Text) + Val(Text1(6).Text)不明白这段代码的意思,你的整个思路都看不明不知道你要实现什么?
反复频繁的执行Update是会有问题的。
原程序环境:vb6.0 + vfp5.0 + Win98
现在环境:vb6.0 + vfp5.0 + WinXp将ADO改为:CursorLocation:adUseserver;
并在程序前加:On Error Resume Next
OK!!!