PublicClass Form1Class Form1 Private db AsNew LzmTW.Data.SqlDatabase(".", "NorthWind") PrivateSub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim SqlCreate AsString="CREATE TABLE Simple(ID int , Photo image, sex bit)" db.Execute(SqlCreate) End Sub PrivateSub Button2_Click()Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim table AsNew DataTable("Simple") db.Load("Simple", table, NewString() {"ID"}) Me.DataGridView1.DataSource = table If table.Rows.Count =0ThenReturn Dim row As DataRow = table.Rows(0) Dim bytes() AsByte=CType(row(1), Byte()) Dim m AsNew System.IO.MemoryStream(bytes) Dim t AsNew System.Drawing.Bitmap(m) Me.PictureBox1.Image = t End Sub PrivateSub Button3_Click()Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Using d AsNew OpenFileDialog With d .Multiselect =False .Filter ="*.PNG|*.PNG" If .ShowDialog = Windows.Forms.DialogResult.OK Then Using r AsNew System.IO.BinaryReader(System.IO.File.Open(.FileName, IO.FileMode.Open)) DimlenAsInteger=CInt(New System.IO.FileInfo(.FileName).Length) Dim bytes(len-1) AsByte r.Read(bytes, 0, len) Dim m AsNew System.IO.MemoryStream(bytes) Dim t AsNew System.Drawing.Bitmap(m) Me.PictureBox1.Image = t Dim row As DataRow =CType(Me.DataGridView1.DataSource, DataTable).NewRow row(0) =CType(Me.DataGridView1.DataSource, DataTable).Rows.Count +1 row(1) = bytes row(2) =False CType(Me.DataGridView1.DataSource, DataTable).Rows.Add(row) EndUsing EndIf EndWith EndUsing End Sub PrivateSub Button4_Click()Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click db.Update("Simple", CType(Me.DataGridView1.DataSource, DataTable), NewString() {"ID"}) End Sub PrivateSub Button5_Click()Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click db.Execute("DROP TABLE Simple") End Sub End Class