VB 中实时错误'3021',BOF或EOF中有一个是"真",或者当前的记录以被删除,所需的操作要求一个当前的记录
PrivateSubUpdate_ct()'删除所有以前的记录CtCon.Execute("delete*fromtempCT")'更新表sqlStr="select*f...
Private Sub Update_ct()
'删除所有以前的记录
CtCon.Execute ("delete * from tempCT")
'更新表
sqlStr = "select * from classArray where cClassCode='" & ClassCode & "'" & " order by iTimeN"
cacon.Execute sqlStr
cars.Open sqlStr, cacon, adOpenStatic, adLockOptimistic
cars.MoveFirst
Dim i As Integer
i = 1
clearStr
While (Not cars.EOF)
While cars!iTimeN <> i
'添加一条课程记录
strSql = "insert into tempCT values(" & i & " ," + "'" + wStr(1) + "' ," + "'" + wStr(2) + "' ," + "'" + wStr(3) + "' ," + "'" + wStr(4) + "' ," + "'" + wStr(5) + "' )"
CtCon.Execute strSql
clearStr
i = i + 1
Wend
wStr(cars!iTimeW) = cars!csjname
cars.MoveNext
Wend
'添加一条课程记录
strSql = "insert into tempCT values(" & i & " ," + "'" + wStr(1) + "' ," + "'" + wStr(2) + "' ," + "'" + wStr(3) + "' ," + "'" + wStr(4) + "' ," + "'" + wStr(5) + "' )"
CtCon.Execute strSql
clearStr
While i < 10
'添加一条课程记录
strSql = "insert into tempCT values(" & i & " ," + "'" + wStr(1) + "' ," + "'" + wStr(2) + "' ," + "'" + wStr(3) + "' ," + "'" + wStr(4) + "' ," + "'" + wStr(5) + "' )"
CtCon.Execute strSql
i = i + 1
Wend
End Sub
错误出在cars.MoveFirst 展开
'删除所有以前的记录
CtCon.Execute ("delete * from tempCT")
'更新表
sqlStr = "select * from classArray where cClassCode='" & ClassCode & "'" & " order by iTimeN"
cacon.Execute sqlStr
cars.Open sqlStr, cacon, adOpenStatic, adLockOptimistic
cars.MoveFirst
Dim i As Integer
i = 1
clearStr
While (Not cars.EOF)
While cars!iTimeN <> i
'添加一条课程记录
strSql = "insert into tempCT values(" & i & " ," + "'" + wStr(1) + "' ," + "'" + wStr(2) + "' ," + "'" + wStr(3) + "' ," + "'" + wStr(4) + "' ," + "'" + wStr(5) + "' )"
CtCon.Execute strSql
clearStr
i = i + 1
Wend
wStr(cars!iTimeW) = cars!csjname
cars.MoveNext
Wend
'添加一条课程记录
strSql = "insert into tempCT values(" & i & " ," + "'" + wStr(1) + "' ," + "'" + wStr(2) + "' ," + "'" + wStr(3) + "' ," + "'" + wStr(4) + "' ," + "'" + wStr(5) + "' )"
CtCon.Execute strSql
clearStr
While i < 10
'添加一条课程记录
strSql = "insert into tempCT values(" & i & " ," + "'" + wStr(1) + "' ," + "'" + wStr(2) + "' ," + "'" + wStr(3) + "' ," + "'" + wStr(4) + "' ," + "'" + wStr(5) + "' )"
CtCon.Execute strSql
i = i + 1
Wend
End Sub
错误出在cars.MoveFirst 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询