Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have used this code to connect with my friends postgresql data base with their ip 192.168.1.13 but while connecting show not able to connect at this 192.168.1.13 address ............ but if i use "Server=127.0.0.1;Port=5432;Database=fastek;User Id=postgres;Password=atul;";
as a connection string it connect to my database successfully.... plz tell me if any other properties are required for postgresql connection.below my code is given

string connectionString = "Server=192.168.1.13;Port=5432;Database=CRM;User Id=postgres;Password=jeetsingh;Integrated Security=true;";
                System.Data.IDbConnection dbcon;
                dbcon = new NpgsqlConnection(connectionString);
                dbcon.Open();
                System.Data.IDbCommand dbcmd = dbcon.CreateCommand();
                string sql =  "select table_name from information_schema.tables where table_schema NOT IN ('pg_catalog', 'information_schema');";
                dbcmd.CommandText = sql;
                System.Data.IDataReader reader = dbcmd.ExecuteReader();
                DropDownList3.DataSource = reader;
                DropDownList3.DataValueField = "table_name";
                DropDownList3.DataTextField = "table_name";
                DropDownList3.DataBind();
                reader.Close();
                reader = null;
                dbcmd.Dispose();
                dbcmd = null;
                dbcon.Close();
                dbcon = null;
Posted
Updated 9-Feb-12 19:32pm
v3
Comments
Rajesh Anuhya 10-Feb-12 1:22am    
Edited: Code Tags added.
--RA

1 solution

try link this

Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;


see this link also http://connectionstrings.com/postgre-sql

Thanks
--RA
 
Share this answer
 
v2
Comments
atul tr 10-Feb-12 1:37am    
i want to connect with postgresql database so connection string for postgresql i want
Rajesh Anuhya 10-Feb-12 1:44am    
my Answer Updated.
--RA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900