replacing the value of blank parameter

  • Thread starter Thread starter sean
  • Start date Start date
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)
 
Back
Top