I have code that saves an image from an image window (image in vb6) in SQL, a data type that is an image, and here is the result of that.
Column Name = Picture

My question is: how can I compare the image here?

in my SQL database? My goal here is to check if an image exists image3in my database.
Here is my code and it doesn't work.
Dim arrImageByte() As Byte
Dim strPhotoPath As String
strPhotoPath = Image3.Picture & ".jpg"
Set rs = New ADODB.Recordset
Open strPhotoPath For Binary As
ReDim arrImageByte(FileLen(strPhotoPath))
fNum = FreeFile()
Open strPhotoPath For Binary As
Get
Close fNum
Text1.Text = FreeFile
rs.Open "select * from tbl_image with (nolock) where CONVERT(varbinary,[picture]) = '" & Text1.Text & "'", sql, 1, 1, 1
If rs.RecordCount = 0 Then
MsgBox "Image exist"
Else
MsgBox "Image does not exist."
End If
I think the best way to do this is to convert image3to binary ( Picture Column) and execute the select command.
Please, I hope someone helps me with this.
Tysm
source
share