Dear Experts
Table "employees" has four fields as
sno---name---city-----photo
1------a-----london----
2------b----Tehran----
3------c-----dublin----
I use following codes to pickup employees pictures, How to store photos into table "employees" column photo.
Table "employees" has four fields as
sno---name---city-----photo
1------a-----london----
2------b----Tehran----
3------c-----dublin----
I use following codes to pickup employees pictures, How to store photos into table "employees" column photo.
VB.NET:
Dim OpenFileDialog1 As New System.Windows.Forms.OpenFileDialog
Dim pic As Image
Dim retVal As DialogResult
Dim bExOccured As Boolean
Try
OpenFileDialog1.Multiselect = False
'OpenFileDialog1.InitialDirectory = "C:temp"
OpenFileDialog1.Title = "Please Select a Photo"
OpenFileDialog1.Filter = "JPEG files (*.jpg)|*.jpg|GIF files (*.gif)|*.gif|Bmp Files (*.Bmp)|*.bmp"
retVal = OpenFileDialog1.ShowDialog()
pic = New Bitmap(OpenFileDialog1.FileName)
If retVal = Windows.Forms.DialogResult.Cancel Then
Exit Sub
End If
If retVal = Windows.Forms.DialogResult.OK Then
Label5.Text = OpenFileDialog1.FileName
PictureBox1.Image = pic
Dim filePath As String = Label5.Text
Dim slashPosition As Integer = filePath.LastIndexOf("\")
Dim filenameOnly As String = filePath.Substring(slashPosition + 1)
Label5.Text = filenameOnly
End If