Quantcast
Channel: Generic DBNull function
Viewing all articles
Browse latest Browse all 4

Generic DBNull function

$
0
0
Hi folks,

I usually use c# so I'm stuck on this.

I want a generic method that can handle dbnull's and return the default value for the type

I'n c# you can use the default key word but I can't find any vb version.

The following is what I would want to wrap up into a single method but without using lots of if, cases and gettypes if possible.

Public Function IntegerDefault(ByVal i As Integer) As Integer
        If (IsDBNull(i)) Then
            Return -1
        Else
            Return i
        End If
    End Function

    Public Function StringDefault(ByVal s As String) As String
        If (IsDBNull(s)) Then
            Return ""
        Else
            Return s
        End If
    End Function

Cheers
Jon

Viewing all articles
Browse latest Browse all 4

Latest Images

Pangarap Quotes

Pangarap Quotes

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Trending Articles


Love Quotes Tagalog


Dino Rey para colorear


Libros para colorear


Mandalas de flores para colorear


Dibujos para colorear de perros


Toro para colorear


Gwapo Quotes : Babaero Quotes


Tagalog Long Distance Relationship Love Quotes


RE: Mutton Pies (mely)


Ang Nobela sa “From Darna to ZsaZsa Zaturnnah: Desire and Fantasy, Essays on...


Long Distance Relationship Tagalog Love Quotes


Winx Club para colorear


Orquidea para colorear


Sapos para colorear


Renos para colorear


Dromedario para colorear


mayabang Quotes, Torpe Quotes, tanga Quotes


Tropa Quotes


Mga Tala sa “Unang Siglo ng Nobela sa Filipinas” (2009) ni Virgilio S. Almario


El Vibora (1971) by Francisco V. Coching and Federico C. Javinal





Latest Images

Pangarap Quotes

Pangarap Quotes

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC