用.FIELDS adodb显示多个值
我正在获取一些数据:
rs.Filter = "datapath='" + dpath + "' and analystname='" + aname + "' and reportname='" + rname + "' and batchstate='" + bstate + "'" If Not rs.EOF Then MsgBox rs.Fields("rowid") End If
如果rs.filter
返回多个logging,我如何得到rs.fields("rowid")
给我多个rowid值?
这是ADO,所以使用GetString:
MsgBox rs.GetString
首先检查一些logging是否被返回。
更多信息: http : //www.w3schools.com/ado/met_rs_getstring.asp
do while not (rs.eof and not rs.bof) MsgBox rs.Fields("rowid") rs.movenext() end while
语法可能是错误的,但这是这个想法。
如果你简单地调用rs.Fields("rowId")
,你实际上是要求当前行的列值可能是第一行。 假设logging集返回10行,你想要为每个行的rowId值做什么? 在消息框中分别显示它们? 这意味着10个消息框。 如果这真的是你想要做的,你会做这样的事情:
rs.Filter = "datapath='" + dpath + "' and analystname='" + aname + "' and reportname='" + rname + "' and batchstate='" + bstate + "'" Do Until rs.EOF MsgBox rs.Fields("rowid").Value rs.MoveNext Loop
这里假定rs
是一个只能向前的logging集。 如果您使用的是键集游标,则可能需要调用MoveFirst()。
rs.Filter = "datapath='" + dpath + "' and analystname='" + aname + "' and reportname='" + rname + "' and batchstate='" + bstate + "'" rs.MoveFirst() Do Until rs.EOF MsgBox rs.Fields("rowid").Value rs.MoveNext Loop