首页 > 开发 > 综合 > 正文

Access数据库数据传递的实例方法

2024-07-21 02:13:54
字体:
来源:转载
供稿:网友
菜鸟学堂:

使用access数据库生成申报数据与读入数据的实例方法:

示例:

以下为引用的内容:
sub mwrite()
on error goto thiserr
dim rs as new adodb.recordset
rs.open "dlmd", currentproject.connection, adopendynamic, adlockoptimistic, actable
rs.save "a:/dlmd.adtg", adpersistadtg
rs.close
set rs = nothing
thisexit:
exit sub
thiserr:
msgbox err.description
resume thisexit
end sub
sub mread()
on error goto merr
dim i as integer
dim rsde as new adodb.recordset
dim rsso as new adodb.recordset
rsso.open "a:/dlmd.adtg", "provider=mspersist"
rsde.open "dlmd", currentproject.connection, adopenkeyset, adlockoptimistic, actable
do until rsso.eof
rsde.addnew
for i = 0 to rsso.fields.count - 1
rsde.fields(i) = rsso.fields(rsde.fields(i).name)
next i
rsde.update
rsso.movenext
loop
rsso.close
rsde.close
set rsso = nothing
set rsde = nothing
mexit:
exit sub
merr:
msgbox err.description
resume mexit
end sub

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表