replacing the value of blank parameter

S

sean

HI There,

I have an application where by I am storing images in SQL server, is there a
way in ADO.Net that I can replace the value of a declared varible when it
does not match the conditions say (jpeg,gif). Can I replace this with
another image on the server so that the DB table does not have an empty or
null field value?

I have tried to make the code below but the image (kamt1bkat.jpg) does not
load into the table.

Sean - thanks in advance


if Not ImageContent Is "image/gif" OR ImageContent Is "image/pjpeg" Then
'do nothing
Else
ImageContent = "C:\Documents and
Settings\Administrator\Desktop\kamt1bkat.jpg"
End If

'image
Dim plistingImage As New SqlParameter("@ListingImage", SqlDbType.Image)
plistingImage.Value = ImageContent
myCommand.Parameters.Add(plistingImage)
'image type
Dim plistingImageType As New SqlParameter("@ListingImageType",
SqlDbType.Nchar, 200)
plistingImageType.Value = strImageType
myCommand.Parameters.Add(plistingImageType)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top