Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Throwing exceptions

Reply
Thread Tools

Throwing exceptions

 
 
=?Utf-8?B?U3JpZGhhcg==?=
Guest
Posts: n/a
 
      06-26-2006
Hi,

I would like to know the general procedure to throw exceptions. Lets say
I have a datagrid in my webpage and I am pulling the data for my webpage
using a function. The function accepts parameter CompanyId and returns
datatable. If I pass an empty CompanyId from the webpage, the function
should throw an exception saying "CompanyId is empty". If I pass a Valid
CompanyId, it should return datatable. So how can we return multiple data
typed values from the same function?

Please let me know.

Thanks,
Sridhar.
 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      06-26-2006
Throwing exceptions stops execution. So, if you throw an exception, the
exception is not "returned" from the method, but "thrown" by it. Therefore,
when an exception is thrown, nothing is returned from the method. The method
simply doesn't return.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.


"Sridhar" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I would like to know the general procedure to throw exceptions. Lets say
> I have a datagrid in my webpage and I am pulling the data for my webpage
> using a function. The function accepts parameter CompanyId and returns
> datatable. If I pass an empty CompanyId from the webpage, the function
> should throw an exception saying "CompanyId is empty". If I pass a Valid
> CompanyId, it should return datatable. So how can we return multiple data
> typed values from the same function?
>
> Please let me know.
>
> Thanks,
> Sridhar.



 
Reply With Quote
 
 
 
 
=?Utf-8?B?QXJuZSBHYXJ2YW5kZXI=?=
Guest
Posts: n/a
 
      06-26-2006
Kevin,
I love your title.

--
Arne Garvander
(I program VB.Net for fun and C# to get paid.)


"Kevin Spencer" wrote:

> Throwing exceptions stops execution. So, if you throw an exception, the
> exception is not "returned" from the method, but "thrown" by it. Therefore,
> when an exception is thrown, nothing is returned from the method. The method
> simply doesn't return.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Professional Chicken Salad Alchemist
>
> Big thicks are made up of lots of little thins.
>
>
> "Sridhar" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > I would like to know the general procedure to throw exceptions. Lets say
> > I have a datagrid in my webpage and I am pulling the data for my webpage
> > using a function. The function accepts parameter CompanyId and returns
> > datatable. If I pass an empty CompanyId from the webpage, the function
> > should throw an exception saying "CompanyId is empty". If I pass a Valid
> > CompanyId, it should return datatable. So how can we return multiple data
> > typed values from the same function?
> >
> > Please let me know.
> >
> > Thanks,
> > Sridhar.

>
>
>

 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      06-26-2006
Sridhar,

When you throw an exception inside your function, the function doesn't
return a value in a regular way. The whole chain of the code execution
breaks. The function won't finish and the next code to execute will be your
catch block if you have any. If you don't, you will get a message about an
unhandled exception.

Eliyahu

"Sridhar" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I would like to know the general procedure to throw exceptions. Lets say
> I have a datagrid in my webpage and I am pulling the data for my webpage
> using a function. The function accepts parameter CompanyId and returns
> datatable. If I pass an empty CompanyId from the webpage, the function
> should throw an exception saying "CompanyId is empty". If I pass a Valid
> CompanyId, it should return datatable. So how can we return multiple data
> typed values from the same function?
>
> Please let me know.
>
> Thanks,
> Sridhar.



 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      06-26-2006


"Arne Garvander" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Kevin,
> I love your title.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Native Code Throwing Developer-Defined Java Exceptions res7cxbi@verizon.net Java 8 01-03-2006 11:55 AM
Throwing Exceptions =?Utf-8?B?Q2xpdmU=?= ASP .Net 1 02-20-2004 03:23 PM
Throwing Exceptions C ASP .Net 2 11-06-2003 03:02 PM
Newbie question - Throwing Exceptions. John Leonard Java 7 10-01-2003 01:45 PM
[JNI] Problem throwing my own exceptions Loic Minier Java 1 08-19-2003 07:52 AM



Advertisments