@H_403_0@
@H_403_0@
@H_403_0@
@H_403_0@上诉三点部分有截图,接下来进行vb.net中对该数据库的连接 @H_403_0@1.安装Npgsql驱动,从网站
http://pgfoundry.org/projects/npgsql/下载
2.解压Npgsql驱动包,在你的vb.net项目中引用Npgsql.dll
3.代码实现如下
Imports Npgsql
Public Class Form1
Public Autumn_CString As String
Public ESQ_name = ""
Private Sub Button1_Click(sender As Object,e As EventArgs) Handles Button1.Click
Dim conn As NpgsqlConnection = New NpgsqlConnection("Server=192.168.210.250;Port=5432;User Id=postgres;Password=postgres;Database=help;")
conn.Open()
Dim Command As NpgsqlCommand = New NpgsqlCommand("select * from kefu",conn)
Try
Dim dr As NpgsqlDataReader = Command.ExecuteReader()
dr.Read()
TextBox1.Text = dr(2).ToString
conn.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub TextBox1_TextChanged(sender As Object,e As EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub TextBox2_TextChanged(sender As Object,e As EventArgs) Handles TextBox2.TextChanged
End Sub
End Class
最后实现连接成功。