Als ik de volgende code inklop krijg ik een fout:
Compile error:
Expected: =
De fout zit in de regel van: ListView1.ListItems.Add(, , objRS.Fields!firstname)
Volgens mij is de syntax goed...
Iemand?
Compile error:
Expected: =
De fout zit in de regel van: ListView1.ListItems.Add(, , objRS.Fields!firstname)
Volgens mij is de syntax goed...
Iemand?
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| Private Sub Command1_Click()
Dim objConn As New ADODB.Connection
Dim objRS As New ADODB.Recordset
Dim objErr As ADODB.Error
objConn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=develop;Data Source=FATBOY"
objConn.CursorLocation = adUseClient
If objConn.State = adStateOpen Then
objRS.CacheSize = 10
objRS.Open "SELECT firstname, lastname FROM contacts", objConn, adOpenStatic, adLockOptimistic
If Not objRS.EOF And Not objRS.BOF Then
ListView1.ListItems.Add(, , objRS.Fields!firstname)
End If
objRS.Close
Else
For Each objErr In objConn.Errors
MsgBox objErr.Description
Next
End If
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
End Sub |