473,382 Members | 1,563 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,382 software developers and data experts.

How best pass errors from SQL to business, user tiers?

How would you recommend passing errors back from your proc to your business
tier to the client (assuming you have full control of all layers)?

Take InsertUser for instance. The proc will automatically raise an error if
someone tries to create a user name for themselves that is already taken.

I could relay that error to the client but the message is not so user
friendly.

I could do a SELECT in my proc to see if the user name is already in use and
could then send back @@ERROR = 99 or some other value. But then that would
require my two layers "getting together" on what each value will mean.

Should I instead be sending back more user friendly error strings from the
proc that are then passed back to the client?

What is a best practice that you would recommend?

Thanks,
Ron

Jun 26 '07 #1
1 1377
Ysgrifennodd Ronald S. Cook:
How would you recommend passing errors back from your proc to your business
tier to the client (assuming you have full control of all layers)?

We use custom exceptions. That is, we throw an exception of an
appropriate type, with an appropriate message.

Our exceptions are defined in their own libraries, which we reference
wherever they are needed. Needless to say all our custom exceptions
share a namespace.
Peter
Jun 26 '07 #2

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

Similar topics

0
by: ekramer17 | last post by:
I would very much appreciate a little advice on the design of business entity components in my application. Among others, there are two entities in my application: books and boxes. The...
16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
2
by: hans | last post by:
Hi! I am new to .NET (coming from Java). We have to implement a desktop application which extracts data from a database, does some analysis, filtering etc. and displays the results. I have...
4
by: Josh Harris | last post by:
Here is my question: It is common to have many pieces of business logic encapsulated within asp.net user controls. This can be found in high visibility projects such as the iBuySpy portal from...
6
by: ari | last post by:
hey all, i have a combo of dropdownlists and a textbox that allows a user to filter her dataset for a datagrid on a webform. the way i'm doing it now is i have an array that i pass from the ui,...
5
by: csgraham74 | last post by:
Hi guys, Basically i have been developing in dotnet for a couple of years but ive had a few issues in regards to error handling. For example - I have a class that i call passing in a stored...
3
by: =?Utf-8?B?TWljaGFlbA==?= | last post by:
Hi, I have been developing using C# in ASP.Net for about a year now. And have been a programmer for about 10 years. I have learned many different things in .NET, but still when I look at sample...
7
by: Steve | last post by:
I am building an object library for tables in a database. What is the best practice for creating objects like this? For example, say I have the following tables in my database: User: - Id -...
0
by: Ronald S. Cook | last post by:
How would you recommend passing errors back from your proc to your business tier to the client (assuming you have full control of all layers)? Take InsertUser for instance. The proc will...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.