I think catching the exception is the proper way. If the database is on the
same machine you can of course just check if the file exists directly.
you may want to differentiate based on the message in the exception like
this:
Catch ex As Exception
If ex.Message.Contains("Error while trying to open file") Then
msgboxExclaim(String.Format("Error while opening database
file - file probably does not exist" & vbCrLf & vbCrLf & "{0}", ex.Message))
ElseIf ex.Message.Contains("The operation has timed out") Then
msgboxExclaim("Operation Timed out - Please try to Log In
again.")
Else
msgboxExclaim(ex.Message)
End If
On Mon, Jan 24, 2011 at 10:28 AM, Marc Bettex <bet...@epsitec.ch> wrote:
> Hi,
>
> I would like to know if there is a proper way to check if a given database
> exists with the Firebird .Net provider.
>
> Currently, I try to open a connection to the database, and if this fails by
> throwing an exception, I assume that this is because the database does not
> exist. But that's not a solution I feel comfortable with, because there
> might be other reason for the exceptions to be thrown. So, is there a
> better
> way to do it?
>
> Thank you,
> Marc
>
>
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better
> price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Firebird-net-provider mailing list
> Firebird-net-provider@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
>
--
Gerdus van Zyl
http://about.me/gerdus
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider