0
Good morning, I am conducting a school project in Visual Basic 2010 with the link to an Access database on Football. But I want to do something more complex and include images in the players, unfortunately I have a lot of difficulty in this, the type of data I put in the Database is OLE Object In Visual Basic I have a Picturebox with an Openfiledialong with this code:
Try
OpenFileDialog1.Title = "Abrir Imagem"
OpenFileDialog1.FileName = "Imagens"
OpenFileDialog1.Filter = "All Files |*.*"
OpenFileDialog1.ShowDialog()
ImgLigaPictureBox.Image =
System.Drawing.Image.FromFile(OpenFileDialog1.FileName)
Catch ex As Exception
'Do nothing End Try
End Try
This code allows to search the image on the computer, I wanted now that the image was saved through a querie. I don’t know if this is possible, if anyone can help.
Although it is possible to save images in the database, in most cases what is done is to save the file on disk and write only the path to the database. That you could do?
– bfavaretto
Unfortunately I don’t know
– TdKing
You want something like
INSERT INTO Tabela1 (Imagem) VALUES (?)
? I can even create the code to insert images into the record, but in Access it is not recommended to do this because it records the lines sequentially making them large and misaligned, thus causing the queries to become slower and slower. For Access the best approach is to do the same as op @bfavaretto mentioned, create a column of typestring
and save in this column the image path.– Augusto Vasques
Another approach is to give up Access and use an SGDB(Mysql, Oracle, Sqlserver or even Firebird) because SGDB is organized in data bales so that the image is not stored directly on the line but is referenced to a portion within the file itself( depending on the system an external file).
– Augusto Vasques