Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Exception Handling Basics

2 posts in DataWindow .NET Last posting was on 2004-12-08 20:06:44.0Z
DGerdner Posted on 2004-12-08 19:38:53.0Z
From: "DGerdner" <dave@ptax.org>
Newsgroups: sybase.public.datawindow.net
Subject: Exception Handling Basics
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
X-Original-NNTP-Posting-Host: ool-4353a821.dyn.optonline.net
Message-ID: <41b75848$1@forums-2-dub>
X-Original-Trace: 8 Dec 2004 11:38:48 -0800, ool-4353a821.dyn.optonline.net
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 8 Dec 2004 11:38:49 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 8 Dec 2004 11:38:53 -0800
X-Trace: forums-1-dub 1102534733 10.22.108.75 (8 Dec 2004 11:38:53 -0800)
X-Original-Trace: 8 Dec 2004 11:38:53 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:917
Article PK: 125346

Re: The following code. My thought was that I would catch the expected
errors using dberrorexception, then use a general Exception catch in case
some other kind of error occurs. However, while DbErrorExceptions are
properly caught, if the retrieval argument is null the "catch (Exception
ex)" failes; giving the general null error message and then aborting the
application. Something tells me there is something very fundamental which I
am missing. Any thoughts?

try
{
dw_list.Retrieve(d_project_id);
}
catch (Sybase.DataWindow.DbErrorException ex)
{
MessageBox.Show("Error retrieving data. " + ex.SqlErrorText);
}
catch (Exception ex)
{
MessageBox.Show ( "Unexpected Error." );

--
David L Gerdner
Next Generation Software, Inc.
201-571-0425


DGerdner Posted on 2004-12-08 20:06:44.0Z
From: "DGerdner" <dave@ptax.org>
Newsgroups: sybase.public.datawindow.net
References: <41b75848$1@forums-2-dub>
Subject: Re: Exception Handling Basics
Lines: 33
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
X-Original-NNTP-Posting-Host: ool-4353a821.dyn.optonline.net
Message-ID: <41b75ed0$1@forums-2-dub>
X-Original-Trace: 8 Dec 2004 12:06:40 -0800, ool-4353a821.dyn.optonline.net
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 8 Dec 2004 12:06:41 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 8 Dec 2004 12:06:44 -0800
X-Trace: forums-1-dub 1102536404 10.22.108.75 (8 Dec 2004 12:06:44 -0800)
X-Original-Trace: 8 Dec 2004 12:06:44 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.datawindow.net:918
Article PK: 125342

Please ignore - I just realized the null exception is a C# class, not a
datawindow class.

"DGerdner" <dave@ptax.org> wrote in message news:41b75848$1@forums-2-dub...
> Re: The following code. My thought was that I would catch the expected
> errors using dberrorexception, then use a general Exception catch in case
> some other kind of error occurs. However, while DbErrorExceptions are
> properly caught, if the retrieval argument is null the "catch (Exception
> ex)" failes; giving the general null error message and then aborting the
> application. Something tells me there is something very fundamental which
I
> am missing. Any thoughts?
>
> try
> {
> dw_list.Retrieve(d_project_id);
> }
> catch (Sybase.DataWindow.DbErrorException ex)
> {
> MessageBox.Show("Error retrieving data. " + ex.SqlErrorText);
> }
> catch (Exception ex)
> {
> MessageBox.Show ( "Unexpected Error." );
>
> --
> David L Gerdner
> Next Generation Software, Inc.
> 201-571-0425
>
>