Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NVL() in VB?
Message
 
To
23/06/2006 14:24:02
Elyse Pomerantz
Dynamic Data Concepts, Inc.
Brooklyn, New York, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Miscellaneous
Thread ID:
01131276
Message ID:
01131281
Views:
12
Elyse,
This is how they did it in the VFP Toolkit for .NET
		/// <summary>
		/// Receives two objects as parameters and returns the one which is not null. If both of them are null
		/// then returns a null, if the first one is not null then returns the first object.
		/// <pre>
		/// Example:
		/// string myNullObj;	//The string is not initialized yet
		/// VFPToolkit.common.NVL("mystring", myNullObj);	//returns mystring object
		/// Note: All strings, int, long etc. all of them are objects
		/// </summary>
		/// <param name="oExp1"></param>
		/// <param name="oExp2"></param>
		/// <returns></returns>
		public static object NVL(object oExp1, object oExp2)
		{
			//if oExp1 is not null then return oExp1
			if (oExp1 != null)
			{
				return oExp1;
			}
			else if ((oExp1 == null) && (oExp2 != null))
			{
				//If oExp1 is null return oExp2
				return oExp2;
			}
			else
				//If both of them are null return nothing
				return null;
		}
I think the source code is available in VB also. If you are not familiar with the Visual FoxPro Toolkit for .NET I would recomend taking a look at it. (http://foxcentral.net/microsoft/VFPToolkitNET.htm)

HTH,
Einar

>Is there an equivalent in VB .Net to VFP's NVL()? This would be similar to SQL Server's COALESCE() function where it returns the first non-null value from a list of parameters.
>
>Thanks,
>Elyse
Semper ubi sub ubi.
Previous
Reply
Map
View

Click here to load this message in the networking platform