How To Insert Update Delete Search Display Images in SQL Database Using
How To Insert Update Delete Search Display Images in SQL Database Using
VB.Net
Imports System.Data.SqlClient
Imports System.IO
Imports System.Drawing.Imaging
DataGridView1.RowTemplate.Height = 100
Dim imgc As New DataGridViewImageColumn
DataGridView1.DataSource = table
imgc = DataGridView1.Columns(3)
imgc.ImageLayout = DataGridViewImageCellLayout.Stretch
End Sub
PictureBox1.Image = Image.FromFile(opf.FileName)
End If
End Sub
TextBoxID.Text = DataGridView1.CurrentRow.Cells(0).Value
TextBoxName.Text = DataGridView1.CurrentRow.Cells(1).Value
TextBoxDesc.Text = DataGridView1.CurrentRow.Cells(2).Value
End Sub
connection.Open()
If MyCommand.ExecuteNonQuery = 1 Then
MessageBox.Show(MyMessage)
Else
End If
connection.Close()
populateDatagridview("")
End Sub
End Sub
End Sub
End Sub
DataGridView1.AllowUserToAddRows = False
DataGridView1.RowTemplate.Height = 100
Dim imgc As New DataGridViewImageColumn
DataGridView1.DataSource = table
imgc = DataGridView1.Columns(3)
imgc.ImageLayout = DataGridViewImageCellLayout.Stretch
End Sub
populateDatagridview(TextBoxSearch.Text)
End Sub
adapter.Fill(table)
Else
TextBoxID.Text = table.Rows(0)(0).ToString()
TextBoxName.Text = table.Rows(0)(1).ToString()
TextBoxDesc.Text = table.Rows(0)(2).ToString()
img = table.Rows(0)(3)
PictureBox1.Image = Image.FromStream(ms)
End If
End Sub
End Class
///////////////OUTPUT: