Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

When setting a default value for a returned new primary key if something goes wrong. Is it better to have a null, or 0 value returned?

$
0
0

In the following, is it better to have this?

public static void InsertNewItemsAndGetPrimaryKeyWithCheck(List<ArrayList> alStrSQL, List<ArrayList> al, ref object objIdentity)
        {
            objIdentity = null;
code....
}

or this?

public static void InsertNewItemsAndGetPrimaryKeyWithCheck(List<ArrayList> alStrSQL, List<ArrayList> al, ref object objIdentity)
        {
            objIdentity = 0
code....
}
The first one returns null if it doesn't work, and the second one returns 0.
Which is a best practices?


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>