473,394 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

end routine

I have a C# webmethod that returns a dataset, What i want to do is if an
error occurs to call the error method and pass that back to the front end
client app.
i have
public dataset names()
{
dbconnection;
try
{
//excute SP's
}
catch (Exception e)
{
logErrors(e.message) // if this then call logErrors then stop
processing this method
}
return dataset
}
Nov 16 '05 #1
1 1138
Mike,

You can re-throw the error, like so:

public dataset names()
{
dbconnection;
try
{
//excute SP's
}
catch (Exception e)
{
logErrors(e.message) // if this then call logErrors then stop
processing this method

// Re-throw the exception.
throw;
}
return dataset
}

This will re-throw the error. Now it is interesting that you bring up
that this is a web method. You *might* be able to eliminate the error
handling from your code altogether (at least in the web method itself).
What you might be able to do is create an implementation of IHttpHandler and
then pass through to the default handler. Basically, upon return, you would
check the response to see if there is an exception in it. If there is, then
you would log it, and then let the result return normally. This would
eliminate the need to place try/catch blocks everywhere and re-throw the
exception.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mike" <Mi**@discussions.microsoft.com> wrote in message
news:F4**********************************@microsof t.com...
I have a C# webmethod that returns a dataset, What i want to do is if an
error occurs to call the error method and pass that back to the front end
client app.
i have
public dataset names()
{
dbconnection;
try
{
//excute SP's
}
catch (Exception e)
{
logErrors(e.message) // if this then call logErrors then stop
processing this method
}
return dataset
}

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Roberto Dias | last post by:
I developed a DFT routine using a language named "ATP Model Language". It is based on FORTRAN and specific to electromagnetic transients simulations, a study field in electrical engineering. Few...
1
by: peteh | last post by:
Hi All; I'm having a problem running an external routine (C language) under DB2 8.2 (FP 9) on AIX 5.3. Since the code was mostly copied from the DB2 sample library, I'm pretty sure it's sound....
7
by: Morgan | last post by:
I have read much posts on the argument but no one clearly says if this operation is possible or not. Simply I have a routine which reads from a text file some integer arrays (1 or 2D). The...
7
by: active | last post by:
I have a VB6 app that is being converted to VB.NET. It contains a routine (large) that is sometimes called with a PictureBox and sometimes with a Printer. I think it was common in VB6 to use the...
1
by: everymn | last post by:
Hi, Supposedly the Alter Routine privilege can be granted at the level of a single routine but I haven't been able to get that to work. I've tried it a number of different ways like: GRANT...
7
by: Bob Darlington | last post by:
I'm using the following routine to call UpdateDiary() - below: Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo Form_BeforeUpdate_Error Call UpdateDiary(Me!TenantCounter,...
5
by: Railgunner | last post by:
I am looking for a routine that can evaluate boolean expressions like: IF/ELSE-IF (X1=X2 AND (Y=1 OR Z1=Z2)) IF/ELSE-IF (A$='Y' AND B=1) OR (C=1 AND D>E) etc. I can handle...
0
by: Independent | last post by:
Python programmers may find the application to decoding an encrypted map image format known as Memory Map to produce a standard PNG image file interesting. Someone obviously very well versed in...
0
by: james.duckworthy | last post by:
Python programmers may find the application to decoding an encrypted map image format known as Memory Map to produce a standard PNG image file interesting. Someone obviously very well versed in...
2
by: pvong | last post by:
I'm a newbie. I'm using VS2008 & VB.net I have a simple site and each page uses the same sub-routine. I copy and paste to each page and that's no big deal but that can get tiresome. I was...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.