VB读取关系数据库并显示出来
cn.OpenstrCncn.CursorLocation=adUseClientsq="select*fromprogramwhereid>5475andhasvoid...
cn.Open strCn
cn.CursorLocation = adUseClient
sq = "select * from program where id > 5475 and hasvoid like '%有%' "
'sq = "select mediacontent.sourcefilename from program,mediacontent where program.hasvoid = '有' and program.assetid = mediacontent.assetid"
rs.Open sq, cn
MsgBox "找到" & rs.RecordCount & "条记录"
a99 = rs.Fields("assetid")
a0 = rs.Fields("programname")
上面那条sq数据可以通过Fields() 方法取到数据
下面那条sq数据却报错. 想请问可以用什么方法得到sq里面的数据? 展开
cn.CursorLocation = adUseClient
sq = "select * from program where id > 5475 and hasvoid like '%有%' "
'sq = "select mediacontent.sourcefilename from program,mediacontent where program.hasvoid = '有' and program.assetid = mediacontent.assetid"
rs.Open sq, cn
MsgBox "找到" & rs.RecordCount & "条记录"
a99 = rs.Fields("assetid")
a0 = rs.Fields("programname")
上面那条sq数据可以通过Fields() 方法取到数据
下面那条sq数据却报错. 想请问可以用什么方法得到sq里面的数据? 展开
1个回答
2018-11-24 · 知道合伙人IT服务行家
关注
展开全部
第二条语句里面,只查询出来一个mediacontent.sourcefilename字段,怎么去填写rs.Fields("assetid")、rs.Fields("programname")呢? 你改成这样试试:
sq = "select * from program,mediacontent where program.hasvoid = '有' and program.assetid = mediacontent.assetid"
sq = "select * from program,mediacontent where program.hasvoid = '有' and program.assetid = mediacontent.assetid"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询