|
-
Aug 13th, 2010, 05:41 PM
#1
Thread Starter
Member
[RESOLVED] How to check DBNull Value?
Hi,
I have a problem with verifying dbnull value. Actually I don't know the syntax.
Here is the code.
Code:
If Not IsDBNull(Me.DeliveryReviewDataSet.Delivery(Me.CustomerIDListBox.SelectedIndex).Signature) Then
"Signature" is the image field (binary data).
Any help will be appreciated.
Thanks
zhtway
-
Aug 13th, 2010, 05:47 PM
#2
Thread Starter
Member
Re: How to check DBNull Value?
Hi,
I post it in the wrong place. don't know how to move to VB forum
zhtway
-
Aug 13th, 2010, 05:49 PM
#3
Re: How to check DBNull Value?
 Originally Posted by zhtway1
I post it in the wrong place. don't know how to move to VB forum
But I do...Moved From The CodeBank
-
Aug 14th, 2010, 02:05 AM
#4
Re: How to check DBNull Value?
There are various ways to check for NULL and the best way depends the circumstances. In your case, you're using a typed DataSet so it specifically provides methods for you to set a field to NULL and to determine if a field is NULL. First up, if you want the row selected in the ListBox:
vb.net Code:
Dim row As DeliveryDataRow = DirectCast(Me.DeliveryBindingSource.Current, DeliveryDataRow) If row.IsSignatureNull() Then 'Signature is NULL. End If
The converse operation uses the SetSignatureNull method.
-
Aug 15th, 2010, 04:04 PM
#5
Thread Starter
Member
Re: How to check DBNull Value?
Hi,
Thanks for your reply.
I have to modify code from your reply as it showed up with errors.
Pls correct me if I am wrong.
Error is "Error:unable to cast object of type 'System.data.datarowview' to type 'DeliveryRow'.
Code:
Dim row As DeliveryReviewDataSet.DeliveryRow = DirectCast(Me.DeliveryBindingSource.Current, DeliveryReviewDataSet.DeliveryRow)
If row.IsSignatureNull() Then
MsgBox("it is null")
End If
Thanks again,
zhtway
-
Aug 15th, 2010, 07:30 PM
#6
Re: How to check DBNull Value?
Ah, sorry. That's the risk when typing straight into the forum rather than an IDE. It should actually be:
vb.net Code:
Dim row As DeliveryReviewDataSet.DeliveryRow = DirectCast(DirectCast(Me.DeliveryBindingSource.Current, DataRowView).Row, DeliveryReviewDataSet.DeliveryRow)
-
Aug 19th, 2010, 04:21 PM
#7
Thread Starter
Member
Re: [RESOLVED] How to check DBNull Value?
Hi,
Thanks for your help!
It solved.
rgds,
zhtway
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|