mports System.Data.OleDb Imports System.IO Public Class admission Private Const ParameterName As String = "@dob" Public conn As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\goodwill.accdb") Public cmd As New OleDb.OleDbCommand Public dr As OleDb.OleDbDataReader Private Sub BunifuTextBox5_TextChanged(sender As Object, e As EventArgs) Handles txt_phone.TextChanged End Sub Private Sub BunifuTextBox6_TextChanged(sender As Object, e As EventArgs) Handles txt_phone2.TextChanged End Sub Sub save() Try conn.Close() conn.Open() Dim cmd As New OleDb.OleDbCommand("insert into admission(`fullname`,`father`," & "`mother`,`guardian`,`address`,`phone1`,`phone2`,`email`" & ",`aadhaar`,`dob`,`gender`,`blood`,`aclass`,`rollno`,`pic`)" & " values(@fullname,@father,@mother,@guardian,@address," & "@phone1,@phone2,@email,@aadhaar,@dob,@gender,@blood,@aclass,@rollno,@pic)", conn) With cmd.Parameters .Clear() .AddWithValue("@fullname", txt_fullname.Text) .AddWithValue("@father", txt_father.Text) .AddWithValue("@mother", txt_mother.Text) .AddWithValue("@guardian", txt_gurdian.Text) .AddWithValue("@address", txt_address.Text) .AddWithValue("@phone1", txt_phone.Text) .AddWithValue("@phone2", txt_phone2.Text) .AddWithValue("@email", txt_email.Text) .AddWithValue("@aadhaar", txt_aadhaar.Text) .AddWithValue(ParameterName, CDate(dobPicker.Value)) .AddWithValue("@gender", cboGender.Text) .AddWithValue("@blood", cboBlood.Text) .AddWithValue("@aclass", cboClass.Text) .AddWithValue("@rollno", txtrollno.Text) End With 'image convert to binary formate Dim FileSize As New UInt32 Dim mstream As New System.IO.MemoryStream register_picturebox.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg) Dim picture() As Byte = mstream.GetBuffer FileSize = mstream.Length mstream.Close() cmd.Parameters.AddWithValue("@pic", picture) cmd.ExecuteNonQuery() MsgBox("Registered successfully", MsgBoxStyle.Information) Catch ex As Exception MsgBox(ex.Message) Finally conn.Close() End Try End Sub Private Sub BunifuLabel3_Click(sender As Object, e As EventArgs) End Sub Private Sub btn_Save_Click(sender As Object, e As EventArgs) Handles btn_Save.Click save() End Sub Private Sub btn_browse_Click(sender As Object, e As EventArgs) Handles btn_browse.Click Dim pop As OpenFileDialog = New OpenFileDialog If pop.ShowDialog <> Windows.Forms.DialogResult.Cancel Then register_picturebox.Image = Image.FromFile(pop.FileName) End If End Sub Private Sub BunifuRadioButton2_CheckedChanged2(sender As Object, e As Bunifu.UI.WinForms.BunifuRadioButton.CheckedChangedEventArgs) End Sub Private Sub admission_Load(sender As Object, e As EventArgs) Handles MyBase.Load dobPicker.Value = Today.Date End Sub Private Sub dobPicker_ValueChanged(sender As Object, e As EventArgs) Handles dobPicker.ValueChanged End Sub End Class