Connecting PostgreSQL via System ODBC DSN?

Connecting PostgreSQL via System ODBC DSN?

mucip
Collaborator Collaborator
1,142 Views
1 Reply
Message 1 of 2

Connecting PostgreSQL via System ODBC DSN?

mucip
Collaborator
Collaborator

Hi,

I have PostgreSQL ODBC SystemDSN and tested connection successfully.

I have below VB code and connecting PostgreSQL without problem.

Dim SQLKomut As String
Dim MyCommand As OdbcCommand
Dim myConnectionString As String = ("Dsn=PostgreSQL35W;Server=127.0.0.1;Port=5432;Database=NameOfUser;Uid = postgres;Pwd=PASS")

Dim myConnection = New OdbcConnection(myConnectionString)

        Try
            myConnection.Open()            
        Catch ex As Exception
            MsgBox("Veri tabanına ulaşılamıyor!")
            MsgBox(ex.Message)
            Exit Sub
        End Try

SQLKomut = "DELETE from agac_takas;"
MyCommand = New OdbcCommand(SQLKomut, myConnection)
MyCommand.ExecuteNonQuery()

 

But I could not do the same thing in VBA?

 

Regards,

Mucip:)

0 Likes
Accepted solutions (1)
1,143 Views
1 Reply
Reply (1)
Message 2 of 2

mucip
Collaborator
Collaborator
Accepted solution

Hi,

I found a solution here. Thanks.

https://forums.autodesk.com/t5/vba/saving-data-to-mdb-from-autocad-vba/td-p/350175

 

 

Regards,

Mucip:)

0 Likes