Re: Problems with IsDbNull()
From: Marina (someone_at_nospam.com)
Date: 09/24/04
- Next message: William \(Bill\) Vaughn: "Re: ADO.NET questions"
- Previous message: ToddT: "database encyption products"
- In reply to: Julian Crofton: "Problems with IsDbNull()"
- Next in thread: Julian Crofton: "Re: Problems with IsDbNull()"
- Reply: Julian Crofton: "Re: Problems with IsDbNull()"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 24 Sep 2004 12:48:47 -0400
The object you are trying to cast to a string, cannot be. You can try
calling .ToString() on it, but make sure you are not holding a null
reference, as that will result in a null reference exception.
"Julian Crofton" <no.spam@any.time> wrote in message
news:41544242$0$583$afc38c87@news.easynet.co.uk...
> Can anyone suggest why the following does not work?
> -----------------
> Public Function SafeDbText(ByVal Value As Object) As String
> Try
> If IsDBNull(Value) Then
> Return ""
> Else
> Return CStr(Value)
> End If
> Catch ex As Exception
> Return ""
> End Try
> End Function
> -----------------
> I keep getting invalid cast errors.
>
> Julian
>
>
- Next message: William \(Bill\) Vaughn: "Re: ADO.NET questions"
- Previous message: ToddT: "database encyption products"
- In reply to: Julian Crofton: "Problems with IsDbNull()"
- Next in thread: Julian Crofton: "Re: Problems with IsDbNull()"
- Reply: Julian Crofton: "Re: Problems with IsDbNull()"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|