vb 读取access中的记录 。最好用代码

2024-11-28 21:30:31
推荐回答(1个)
回答1:

'command1单击事件代码
dim rs as New ADODB.recordset
dim connstr as string
dim sqlstr as string
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Main.mdb"
sqlstr="select 内容 from ASDF where 代码='" & text1 & "'"
rs.open sqlstr,conn,adOpenKeyset,adLockReadOnly
text2=rs!内容
rs.close
set rs=nothing

祝你成功!