VB中,如果将listbox的内容保存到access中的a表a字段里?
1个回答
展开全部
db = App.Path & "\shuju.mdb" '数据库
connstr = "DBQ=" + db + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)}"
Set conn = CreateObject("ADODB.Connection")
conn.Open connstr
Set oRs = CreateObject("ADODB.Recordset")
sSQL = "Select * From a"
oRs.open Ssql,conn,1,3
for n=0 to List1.ListCount-1
oRs.AddNew()
astr = List1.List(n)
oRs("a") = astr
oRs.Update()
next
oRs.Close()
Set oRs = Nothing
Set conn = Nothing
connstr = "DBQ=" + db + ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)}"
Set conn = CreateObject("ADODB.Connection")
conn.Open connstr
Set oRs = CreateObject("ADODB.Recordset")
sSQL = "Select * From a"
oRs.open Ssql,conn,1,3
for n=0 to List1.ListCount-1
oRs.AddNew()
astr = List1.List(n)
oRs("a") = astr
oRs.Update()
next
oRs.Close()
Set oRs = Nothing
Set conn = Nothing
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询