定义:
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.Command。。
执行:
set rs = cmd.excute
取值:
If rs.Fields(0) <> "" Then
Me.MSFlexGrid1.TextMatrix(1, 0) = "公司名称"
Me.MSFlexGrid1.TextMatrix(1, 1) = rs.Fields(0)
End If
........
if rs.fields(3) <> "" then
...
在rs.fields(3)的时候总是出错“在对应所需名称或序数所需的集合中,未找到项目”
我把rs.fields(3)改成4或者其他比3大的数字就不行了,奇怪啊。
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.Command。。
执行:
set rs = cmd.excute
取值:
If rs.Fields(0) <> "" Then
Me.MSFlexGrid1.TextMatrix(1, 0) = "公司名称"
Me.MSFlexGrid1.TextMatrix(1, 1) = rs.Fields(0)
End If
........
if rs.fields(3) <> "" then
...
在rs.fields(3)的时候总是出错“在对应所需名称或序数所需的集合中,未找到项目”
我把rs.fields(3)改成4或者其他比3大的数字就不行了,奇怪啊。
rs.fields.count
要知道得出的recordset集合中的字段的数量可以用k=recordset.fields.count(大概是这个属性)来得到
然后for i=0 to k
Me.MSFlexGrid1.TextMatrix(1, i) = rs.Fields(i)
next
hoho,可能对你有点帮助
to sxs69():你说的没有用,我写了。
SELECT b.COMPANY_NAME, a.PERSON_NAME, a.PERSON_SEX, a.PERSON_BIRTHDAY,
a.PERSON_NATION, a.PERSON_EDU, a.PERSON_LOCAL, a.PERSON_IDPLACE,
a.PERSON_ADDRESS, c.DOC_ARCH_CONTENT
FROM HES_PERSON a INNER JOIN
HES_COMPANY b ON b.COMPANY_ID = a.PERSON_COMPANYID INNER JOIN
HES_PERSON_ARCH c ON c.DOC_ID = a.PERSON_ID
WHERE (a.PERSON_ID = 30)
查询出来应该有10个字段啊