Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Call validation()
Select Case valid
Case False
Exit Sub
End Select
Try
Dim FileSize As UInteger
Dim mstream As New System.IO.MemoryStream
PictureBox1.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim arrImage() As Byte = mstream.GetBuffer()
FileSize = mstream.Length
mstream.Close()
sqlString = "INSERT INTO tbladminaccount(accname,accposition,accage,accaddress,accpassword,accgender,Acc_pix) VALUES(@field1,@field2,@field3,@field4,@field5,@field6,@urlimage)"
objCommand = New MySql.Data.MySqlClient.MySqlCommand(sqlString, objConn)
With objCommand
.Parameters.AddWithValue("@field1", firstNameTextBox.Text)
.Parameters.AddWithValue("@field2", positionComboBox.Text)
.Parameters.AddWithValue("@field3", ageTextBox.Text)
.Parameters.AddWithValue("@field4", addressTextBox.Text)
.Parameters.AddWithValue("@field5", passwordTextBox.Text)
.Parameters.AddWithValue("@field6", genderComboBox.Text)
.Parameters.AddWithValue("@urlimage", arrImage)
End With
objCommand.ExecuteNonQuery()
objCommand.Dispose()
objDreader.Close()
MessageBox.Show("Account Added!", "Warehouse Monitoring", MessageBoxButtons.OK, MessageBoxIcon.Information)
Call fillAccountListView()
Call clearAllfields()
Call disableAllFields()
Button2.Enabled = False
Button1.Enabled = True
Button3.Enabled = False
Button4.Enabled = False
Catch ex As Exception
MessageBox.Show(ex.Message, "Warehouse Monitoring", MessageBoxButtons.OK, MessageBoxIcon.Stop)
End Try
End Sub
Charisse_1 0 Newbie Poster
DaveAmour 160 Mmmmmm beer Featured Poster
ddanbe commented: Great advice! +15
Reverend Jim commented: Always worth pointing out. +12
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.