我想将我的 VB.NET windows 应用程序与 PostgreSQL 9.3 连接起来 Beibg 是一个初学者,我无法通过 ODBC 和 Npgsql 做到这一点
Dim mDAKap As New Odbc.OdbcDataAdapter
Dim mCon As New Odbc.OdbcConnection
mCon.ConnectionString = "Dsn=PostgreSQL30;database=public;server=127.0.0.1;port=5432;uid=root;pwd=root"
mCon.Open()
我在 mCon.OPen() 上遇到错误
如果我的参数正确,请帮忙?
最佳答案
从另一个来源得到我的答案,在这里写给像我这样的其他初学者,以节省他们的时间:
首先安装 ODBC 驱动程序(在这里获取 http://www.postgresql.org/ftp/odbc/versions/msi/ ) 安装 32 位驱动程序后::
Dim MyCon As New Odbc.OdbcConnection
MyCon.ConnectionString = "Driver={PostgreSQL ANSI};database=database_name;server=127.0.0.1;port=5432;uid=postgres;sslmode=disable;readonly=0;protocol=7.4;User ID=postgres;password=password;"
MyCon.Open()
If mCon.State = ConnectionState.Open Then
MsgBox("Connected To PostGres", MsgBoxStyle.MsgBoxSetForeground)
End If
关于vb.net - 如何将 PostgreSQL 与 VB.NET 应用程序连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21139796/