error handle for reconnect question

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
waertf
Posts: 9
Joined: Sat 07 Jun 2014 01:52

error handle for reconnect question

Post by waertf » Thu 19 Jun 2014 02:43

I call the function in try catch block

Code: Select all

PgSqlConnection.Open()
In catch block want to reconnect
which is the properly ways below?

1.set old PgSqlConnection object to null
,create the new PgSqlConnection object then call Open function
2.without create new object,just call Open again
3.without create new object,call Close then call Open

Pinturiccio
Devart Team
Posts: 2192
Joined: Wed 02 Nov 2011 09:44

Re: error handle for reconnect question

Post by Pinturiccio » Thu 19 Jun 2014 15:44

The properly way is way 3:
waertf wrote:3.without create new object,call Close then call Open

Post Reply