Page 1 of 1

error handle for reconnect question

Posted: Thu 19 Jun 2014 02:43
by waertf
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

Re: error handle for reconnect question

Posted: Thu 19 Jun 2014 15:44
by Pinturiccio
The properly way is way 3:
waertf wrote:3.without create new object,call Close then call Open