0

在 vb.net 控制台应用程序(x64)上使用 odbc 连接器(x64)连接到 postgresql 数据库时出现问题,错误, http://www.sumarlidason.com/tmp/120312/odbc_capture1.png

    Dim ConnectionString = "Driver={PostgreSQL UNICODE};Server=myPGSrv;Port=5432;Database=dbDefault;Uid=postgres;Pwd=pw;"
    'Dim ConnectionString = "ODBC;dsn=PostgreSQL35W"
    conn = New OdbcConnection(ConnectionString)

    'Open connection to an instance of the PostgreSQL database.
    Try
        conn.Open()
    Catch Ex As Exception
        MsgBox(Ex.Message)
    End Try

    Dim commonOdbcCommand = New OdbcCommand
    commonOdbcCommand.Connection = conn
    conn.Close()

另外,我在控制面板中配置了数据库,见这里.. http://sumarlidason.com/tmp/120312/odbc_capture.png

4

1 回答 1

0

正确的连接字符串:

Dim conn As New OdbcConnection("DSN=PostgreSQL35W")
于 2012-12-03T18:20:06.577 回答