Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use of question mark in parameters
Message
From
09/11/2011 10:53:01
 
 
To
09/11/2011 10:48:01
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01528240
Message ID:
01528488
Views:
43
>OK, I guess I misunderstood what you said before. Thanks for clarifying. However, your original code is not checking for the string to be null. You had this:
>
>
>        Public Function GetNonNullable(ByVal tcValue As String) As String
>            Dim lcValue As Integer = ""
>
>            ' If we have a value
>            If Not tcValue Is DBNull.Value Then
>                lcValue = tcValue
>            End If
>
>            Return lcValue
>        End Function
>
>
>Checking for DBNull.Value is NOT the same thing as checking for null! In fact, in C# the above comparison cannot even be made. I think what you actually want to compare is whether it's equal to null (assuming I've gotten the VB syntax correct):
>
>
>        Public Function GetNonNullable(ByVal tcValue As String) As String
>            Dim lcValue As Integer = ""
>
>            ' If we have a value
>            If Not tcValue = null Then
>                lcValue = tcValue
>            End If
>
>            Return lcValue
>        End Function
>
Is this the syntax you are referring to:
        ' Avoid to receive a null
        ' expC1 Value
        Public Function GetNonNullable(ByVal tcValue As String) As String
            Dim lcValue As String = ""

            ' If we have a value
            If Not IsDBNull(tcValue) Then
                lcValue = tcValue
            End If

            Return lcValue
        End Function
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform