Dear All,

 

  I am using   npgsql.dll to connect  postgresql database. Everything is
working fine.but sometimes database is getting slow and even sometimes I am
not getting data .I have written one function which access the data .

 

Below is my code ..

 

 public  NpgsqlConnection PgSqlDataConnection()

        {

            if (pgSqlConnection != null)

            {

                if (pgSqlConnection.State == ConnectionState.Open)

                {

                    pgSqlConnection.Close();

                    //pgSqlConnection.Dispose();

                }

            }

            pgConnectionString =
ConfigurationSettings.AppSettings["ConnectionString"].ToString();

            pgSqlConnection = new NpgsqlConnection(pgConnectionString);

            try

            {

                pgSqlConnection.Open();

            }

            catch (Exception exp)

            {}

            return pgSqlConnection;

       }

       

Please let me where I am doing wrong.

 

I am waiting for your great response.

 

Advanced thanks.

 

Reagrds,

Venkat. 

Reply via email to