1. Don't save whole image in database. It is not a good approach.
2. Save your image at any folder of your project/website and save its path to the database.
If file.PostedFile.ContentLength > 0 Then
Dim strExt As String
strExt = IO.Path.GetExtension(file.PostedFile.FileName)
If imageName = "" Then
strImgName = Trim(Now.Year.ToString & Now.Hour.ToString & Now.Minute.ToString & Now.Millisecond.ToString & imageName)
strImgName = strImgName & strExt
Else
strImgName = imageName & strExt
End If
If Not (checkExt(file.PostedFile.FileName, ".jpg") Or checkExt(file.PostedFile.FileName, ".gif") Or checkExt(file.PostedFile.FileName, ".png")) Then
lblMsg.Text = "Upload only .gif,.png or .jpg file format."
lblMsg.Visible = True
Return ""
End If
If strImagePath <> "" Then
If System.IO.Directory.Exists(strImagePath) Then file.PostedFile.SaveAs(strImagePath & strImgName)
End If
Else
strImgName = ""
End If
3. For displaying image in the crystal report,
Reference-1[
^] and
Reference - 2[
^]
Hope it helps.