Thread: How to use this ODBC

How to use this ODBC

From
"gunawan"
Date:
Dear All,
I need kind a favour from you since i meet difficulties to select a table with Visual Basic 6.0.
this are my code :
 
Dim CN As New ADODB.Connection
Dim tks As String
Dim RS As New ADODB.Recordset
 
Private Sub Command1_Click()
 
     If CN.State = 1 Then CN.Close
    
         
      CN.Open _
          "DSN=postgreSQL;" & _
          "UID=FIN;" & _
          "PWD=FAIKP;" & _
          "Database=Finance"
          
     RS.CursorLocation = adUseClient
    
     tks = "SELECT KodeAkun From 'Akun' " --> *)
         
     RS.Open tks, CN, adOpenDynamic  ---> **)
    
     CN.Close
End Sub
**) I already could establish a connection to the database but still cannot open the recordset.
*)  I try to replace the double quotes  (") that used in pSQL with quote(') in order to run the SQL command, then an error messages shown as below:
 
"The instruction at"0x0476cd8a" referenced memory at "0x000000000". The memory could not be "read".
 
Pls, did any of you could help me.
 
Regards Andi Gunawan