Connection string for Postgre SQL in C#.NET 2005 by Npsql
The Npgsql is based to exist this library (original version) in your project references.
Then define it in your class as next step:
using Npgsql;
{
NpgsqlConnection NpgCon = new NpgsqlConnection(String.Format("Server={0};Port={1};" +
"User Id={2};Password={3};Database= postgres;",
txtServerName.Text, txtPort.Text, txtUserID.Text, txtPassword.Text););
NpgCon.Open();
.
.
.
NpgCon.Close();
}
catch (Exception msg)
{
MessageBox.Show(msg.Message);
throw;
}
Npgsql
Type: .NET Framework Class Library
Usage: Npgsql.NpgsqlConnection
Usage: Npgsql.NpgsqlConnection
The Npgsql is based to exist this library (original version) in your project references.
Then define it in your class as next step:
using Npgsql;
How to use that
try{
NpgsqlConnection NpgCon = new NpgsqlConnection(String.Format("Server={0};Port={1};" +
"User Id={2};Password={3};Database= postgres;",
txtServerName.Text, txtPort.Text, txtUserID.Text, txtPassword.Text););
NpgCon.Open();
.
.
.
NpgCon.Close();
}
catch (Exception msg)
{
MessageBox.Show(msg.Message);
throw;
}
0 comments:
Post a Comment