新手问题! 关于With object 的问题!
我在一过程中这样写的,但总是报错,
Dim nRst As New ADODB.Recordset
Dim tRst As New ADODB.Recordset
Dim Xitm as listitem
Dim strSQL1 As String
Dim strSQL2 As String
strsql1="select * From ABC"
Set nRst = gConn.Execute(strSQL1)
ListView1.ListItems.Clear
If nRst.BOF And nRst.EOF Then
MsgBox "test"
Else
nRst.MoveFirst
For i = 1 To nRst.RecordCount
Set xItem = ListView1.ListItems.Add(, , Trim(nRst!ZYDM), "YJK", "YJK")
With xItem
.SubItems(1) = Trim(nRst!FKFS) & ""
.SubItems(2) = Trim(Format(nRst!YJJE, "0.00")) & ""
.SubItems(3) = Trim(nRst!SJ)
.SubItems(4) = Trim(nRst!CZYMC)
strSQL2="Select SUM(ADBD) ADBD From DEF Where ZYDM='"&TRIM(NRST!ZYDM) &"'"
SET tRst=gConn.Execute(strSQL2)
.SubItems(5)=tRst!ADBD
End With
nRst.MoveNext
Next
END IF