简体   繁体   English

如何将PostgreSQL与VB.NET应用程序连接

[英]How to Connect PostgreSQL with VB.NET Application

I want to connect my VB.NET windows application with PostgreSQL 9.3 Beibg a beginner i am unable to do it through ODBC, and Npgsql 我想将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()

I am getting error on mCon.OPen() 我在mCon.OPen()上遇到错误

Please Help If my parameters are correct? 请帮助如果我的参数正确?

Got my answer from another source, Writing here for other beginners like me, to save their time: 从另一个来源得到了我的答案,在这里写给像我这样的其他初学者,以节省他们的时间:

First install ODBC driver (get it here http://www.postgresql.org/ftp/odbc/versions/msi/ ) After installing 32-bit driver:: 首先安装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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM