Evo koda za konekciju:
Code:
Private Const mcstrDSNBeg As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
Private Const mcstrDSNEnd As String = ";Persist Security Info=False"
Private Const mcstrPath As String = "baza.mdb"
Private Const mcstrDSN As String = mcstrDSNBeg & mcstrPath & mcstrDSNEnd
.
.
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sqlstr As String, Termin as Integer
Set cnn = New ADODB.Connection
cnn.Open mcstrDSN
Set rs = New ADODB.Recordset
Termin = 1
sqlstr = "SELECT Ime FROM Termini WHERE Vreme = " & Termin & ";"
rs.Open sqlstr, cnn
MsgBox rs.RecordCount
rs.close
Private Const mcstrDSNBeg As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
Private Const mcstrDSNEnd As String = ";Persist Security Info=False"
Private Const mcstrPath As String = "baza.mdb"
Private Const mcstrDSN As String = mcstrDSNBeg & mcstrPath & mcstrDSNEnd
.
.
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sqlstr As String, Termin as Integer
Set cnn = New ADODB.Connection
cnn.Open mcstrDSN
Set rs = New ADODB.Recordset
Termin = 1
sqlstr = "SELECT Ime FROM Termini WHERE Vreme = " & Termin & ";"
rs.Open sqlstr, cnn
MsgBox rs.RecordCount
rs.close
Ovo je samo deo koda, pretpostavljam da je greška tu negde. Naime, msgbox mi vraća -1
iako recordset ima više slogova. Takođe je -1 i kada je recordset prazan (BOF).
Probao sam da dodam i rs.MoveFirst kao i rs.Requery ali ne pomaže.
Zašto ?