|
-
Feb 14th, 2009, 08:56 PM
#1
Thread Starter
Member
[RESOLVED] check whether image at dataset is empty or not
im getting a image from my database to a data set. before i convert it to a proper picture i need to check whether ds.Tables("userDetails").Rows(0).Item("photo") is EMPTY or NOT. How should i write the if condition?
<code>If ds.Tables("userDetails").Rows(0).Item("photo")<> ??? Then
Dim pictureData As Byte() = DirectCast(ds.Tables("userDetails").Rows(0).Item("photo"), Byte())
Dim picture As Image = Nothing
Using stream As New IO.MemoryStream(pictureData)
picture = Image.FromStream(stream)
End Using
PictureBox2.Image = picture
Else
MsgBox("No picture")
End If</code>
I tried as follows.
<code>If ds.Tables("userDetails").Rows(0).Item("photo")<> DBNullThen</code>
<code>If ds.Tables("userDetails").Rows(0).Item("photo")<> System.DBNullThen</code>
But didnt work. PLZ help! thanks
-
Feb 14th, 2009, 09:02 PM
#2
Thread Starter
Member
Re: check whether image at dataset is empty or not
Sorry i forgot to say: Im using Visual Studio 2005 & using Microsoft SQL Server Database (Express)
-
Feb 14th, 2009, 10:19 PM
#3
Thread Starter
Member
Re: check whether image at dataset is empty or not
found by myself the answer.
<code> If Not IsDBNull(ds.Tables("userDetails").Rows(0).Item("photo")) Then <\code>
is the answer for my question.
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
|