Using ADO in VBA to connect to PostgreSQL

前端 未结 4 1668
深忆病人
深忆病人 2021-01-24 13:10

I am having trouble finding clear and reliable examples of connecting to a PostgreSQL database from Excel using VBA ADO. Admittedly, I am new to VBA and most examples and tutori

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-24 13:36

    In the original Code, "PostgreSQL35W" is a DSN name which included the default host and port. When you changed to "PostgreSQL Unicode", it is a driver and your connection string is lacking the value for the port. Remember to access PostgreSQL directly from driver, you need at least 5 parameters:

    • host
    • port
    • userid
    • password
    • database

    If you are using DSN, some parameters may be defined as default.

提交回复
热议问题