'อันนี้คือปุ่มเพิ่มรูปนะครับ'
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim open As New OpenFileDialog()
open.Filter = "Image Files(*.png; *.jpg; *.bmp)|*.png; *.jpg; *.bmp"
If open.ShowDialog() = DialogResult.OK Then
Dim fileName As String = System.IO.Path.GetFullPath(open.FileName)
PictureBox1.Image = New Bitmap(open.FileName)
Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
End If
Me.Label7.Text = open.FileName.ToString
End Sub
'อันนี้เป็นปุ่มบันทึกครับ'
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim connStr As String = "server=localhost;user id=root;password=1234; database =137"
Dim conn As MySqlConnection
conn = New MySqlConnection(connStr)
conn.Open()
Dim sql As String = "insert into employee(emp_code,emp_name,emp_address,emp_sex,emp_tel,emp_position,emp_picture) values ('" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox7.Text & "','" & TextBox6.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & Me.Label7.Text & "')"
Dim cmd As MySqlCommand = New MySqlCommand(sql, conn)
cmd.ExecuteNonQuery()
conn.Clone()
conn.Dispose()
MsgBox("บันทึกแล้วครับ")
End Sub