Hi,
I used PostgreSQL and i want to populate its fields in combo box.
Is anyone know how to make it. .
Please help me. . . it is for my project. . :icon_sad:
Here is my code:
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim sSQL As String
Dim IvAR As Integer
Set conn = New ADODB.Connection
conn.ConnectionString = connString
conn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=PostgreSQL30;Initial Catalog=PostgreSQL"
Set rst = New ADODB.Recordset
rst.ActiveConnection = conn
rst.CursorLocation = adUseClient
rst.CursorType = adOpenDynamic
rst.LockType = adLockOptimistic
rst.Fields = "inventory"
rst.Open
If rst.BOF = False Then
Combo1.Clear
For IvAR = 0 To rst.Fields.Count - 1
Combo1.AddItem rst.Fields(IvAR).Name
Combo1.ItemData(Combo1.NewIndex) = IvAR
Next IvAR
If Combo1.ListCount > 0 Then
Combo1.ListIndex = 1
End If
End If
, , Is this correct or not. . if not. . please help me to correct my codes. . . :(
I hope you help me. . .
Thanks in advance. . .