Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NVL() equivalent
Message
 
To
24/10/2002 15:02:54
Rex Mahel
Realm Software, Llc
Ohio, United States
General information
Forum:
ASP.NET
Category:
Databases
Miscellaneous
Thread ID:
00715075
Message ID:
00715118
Views:
17
Hi Rex,

Do you have the VFP Toolkit for .NET? In there you can find the equivalent .NET code. Here is what it says:
[Visual Basic]
Public Shared Function NVL(ByVal oExp1 As Object, ByVal oExp2 As Object) As Object
    'if oExp1 is not null then return oExp1
    If oExp1 <> Nothing Then
        Return oExp1
    ElseIf (oExp1 = Nothing) And (oExp2 <> Nothing) Then
        'If oExp1 is null return oExp2
        Return oExp2
    Else
        'If both of them are null return nothing
        Return Nothing
    End If
End Function

[C#]
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;
}
>All,
>
>Is there an equivalent function to the VFP NVL() function. I want the be able to control what value is in my SQL column if the value is null.
>
>TIA
>
>Rex
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform