Добавление работает
Public Sub ADDChel()
On Error GoTo erro
Dim cn As New ADODB.Connection
' Connection to SQL Server without using ODBC data source.
cn.Open "Driver={SQL Server};Server=dbserv;Database=Basa;UID=sa;PWD=****"
Set adoPrimaryRS = New ADODB.Recordset
adoPrimaryRS.Open "INSERT INTO SPISOK (FIO, Vozrast, Pol, Sotrudnik, Address, Contacts, Klassifikator, Primechanie, Dolgnost) VALUES ('" & txtFIO.Text & "', '" & txtVOZRAST.Text & "', '" & cmbPOL.Text & "', '" & cmbSOTRUDNIK.Text & "', '" & txtADRESS.Text & "', '" & txtCONTACTS.Text & "', '" & txtKLASSIFICATOR.Text & "', '" & txtPRIMECHANIYE.Text & "', '" & txtDOLGNOST.Text & "')", cn
adoPrimaryRS.Close
cn.Close
Exit Sub
erro: MsgBox "Ne katet ibo " & Err.Description
End Sub
Запрос Select возвращает пустоту
Public Sub SelectAll()
Dim cna As New ADODB.Connection
lvSPISOK.ListItems.Clear
' Connection to SQL Server without using ODBC data source.
cna.Open "Driver={SQL Server};Server=dbserv;Database=Basa;UID=sa;PWD=*****;"
Set adoPrimaryRSa = New ADODB.Recordset
adoPrimaryRSa.Open "select * from SPISOK", cna
MsgBox adoPrimaryRSa.RecordCount
If adoPrimaryRSa.RecordCount > 0 Then
adoPrimaryRSa.MoveFirst
For i = 1 To adoPrimaryRSa.RecordCount
With lvSPISOK
Set a = .ListItems.Add(Text:=adoPrimaryRSa.Fields("IDN"))
a.SubItems(1) = IIf(IsNull(adoPrimaryRSa.Fields("FIO")), " ", adoPrimaryRSa.Fields("FIO"))
a.SubItems(2) = IIf(IsNull(adoPrimaryRSa.Fields("Dolgnost")), " ", adoPrimaryRSa.Fields("Dolgnost"))
End With
adoPrimaryRSa.MoveNext
Next
End If
adoPrimaryRSa.Close
cna.Close
End Sub
MsgBox adoPrimaryRSa.RecordCount возвращает -1
Подскажите пожалуйста где накосячил