电解?
Set rs = Nothing
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Open "select * from " + STR_SQL_FIELD + " where 发布中心='" + str_text(1) + "'and 发布时间='" + str_text(2) + "'and TC本科编号='" + str_text(3) + "' and id=1 ", cn
For j = 1 To int_sum
If str_text(j) <> "9999" Then rs!str_name(j) = str_text(j)
Next
rs.Update
rs.Close
数据写不进去?
Set rs = Nothing
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimistic
rs.Open "select * from " + STR_SQL_FIELD + " where 发布中心='" + str_text(1) + "'and 发布时间='" + str_text(2) + "'and TC本科编号='" + str_text(3) + "' and id=1 ", cn
For j = 1 To int_sum
If str_text(j) <> "9999" Then rs!str_name(j) = str_text(j)
Next
rs.Update
rs.Close
数据写不进去?
adLockOptimistic時,只能一條一條的更新,按你所寫的應更新到最後一條.
rs.LockType =adLockBatchOptimistic '批量更新
這樣就行了
rs.Open "select * from " + STR_SQL_FIELD + " where 发布中心= '" + str_text(1) + " 'and 发布时间= '" + str_text(2) + " 'and TC本科编号= '" + str_text(3) + " ' and id=1 ", cn ,1,3
如果这一句话存在,不就把rs指向一个空地址了吗?
后面的代码难道不提示“对象或者变量名未设置”之类的错误?
修改为:
Set rs = new adodb.recordset 如果一定要清除原来数据
可以
if not rs is nothing then
if rs.state < >0 then
rs.close
end if
set rs=nothing
end if 还有,建议在连接string的时候,使用&而不是+For j = 1 To int_sum
If str_text(j) < > "9999" Then rs!str_name(j) = str_text(j)
Next 还有,
这里你需要考虑rs的容量,是不是有int_sum那么多
否则会出错
最好做一个判断
If str_text(j) < > "9999" Then rs!str_name(j) = str_text(j)
Next 还有,
这里你需要考虑rs的容量,是不是有int_sum那么多
否则会出错
最好做一个判断