|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a question on standards in design practices for DLL's / components.
I build large systems that are typically all DLL's, that we then assemble in either an ASP.Net application, Windows Service, or Windows Forms app. Look at this line of code. If the query this business object (objDAL) runs returns ZERO rows, should this function return me a datatable with zero rows, OR, should it return NOTHING. (which means afterwards, I have to check for the object being NOTHING, before I check rows.count) dtbWidgets = objDAL.getWidgets(strColor) If the function returns a datatable with zero rows, I can check the rows.count without getting an exception. Otherwise, I have to add an addition line(s) of code, first checking if dtbEmps is Nothing, before proceeding onwards. What is the norm out there for when the query happens to return zero rows? Are people coding to return Nothing, or table objects with no rows? thanks, appdevman ![]() |
|
#2
|
||||
|
||||
|
think of your closet. usually, it contains clothes, right?
suppose you run query like this: "how many green shirts I have in my closet?" if there are no green shirts, this query should return zero. however, if there is no closet at all, the query should inform this by returning NULL instead of zero - it can also raise custom Error as well. so, if the getWidgets function run correctly and there are simply zero records, just return zero. returning NULL/Empty is more "severe" than returning zero. |
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > Question On Dal Component Design Std |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|