السلام عليكم ورحمة الله وبركاته . اساتذتي الكرام بفضل الله و عونكم اتممت مشروعي شغال 100% لاكن عند التحزيم ظهرت معي مشكلتين مع العلم اني اتعامل مع قاعدة بيانات من نوع (mdb)
الثانية عند الظغط على زر حفظ البيانات تظهر معي هذه الرسالة : (the connection was not closed .the connection's current state is open)
وهذا كودالحفظ
الثانية عند الظغط على زر حفظ البيانات تظهر معي هذه الرسالة : (the connection was not closed .the connection's current state is open)
وهذا كودالحفظ
كود :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim cmd As New OleDb.OleDbCommand
Dim statement As String
conn.Open()
If TextBox2.Text = " " Or TextBox3.Text = "" Or TextBox4.Text = "" Or ComboBox1.Text = "" Or TextBox5.Text = "" Or ComboBox2.Text = "" Or ComboBox3.Text = "" Or TextBox8.Text = "" Or TextBox9.Text = " " Or TextBox10.Text = "" Or TextBox11.Text = "" Or TextBox12.Text = "" Or ComboBox4.Text = "" Or ComboBox5.Text = "" Or TextBox14.Text = "" Or ComboBox6.Text = "" Then
MessageBox.Show("يرجى اكمال البيانات")
conn.Close()
Else
statement = "INSERT INTO annagui (nom, prenom , date_de_naissance ,lieu_de_naissance , sex , numero_passport ,date_validation,date_expired,age,cin,numero_cin,autre_nationalite,nom_pere,nom_grand_pere,nom_mere,prenom_mere,profession,qualite,email,adresse_uae,tel_uae,etat_civil,nom_epou,prenom_epou,validation,expired,remarque,r_sex,r_etat ) VALUES ( '" & TextBox2.Text & "','" & TextBox3.Text & "','" & DateTimePicker1.Value.ToString("dd/MM/yyyy") & "','" & TextBox4.Text & "','" & ComboBox1.Text & "','" & TextBox5.Text & "','" & DateTimePicker2.Value.ToString("dd/MM/yyyy") & "','" & DateTimePicker3.Value.ToString("dd/MM/yyyy") & "','" & TextBox6.Text & "','" & ComboBox2.Text & "','" & TextBox7.Text & "','" & ComboBox3.Text & "','" & TextBox8.Text & "','" & TextBox9.Text & "','" & TextBox10.Text & "','" & TextBox11.Text & "','" & TextBox12.Text & "','" & ComboBox4.Text & "','" & TextBox13.Text & "','" & ComboBox5.Text & "','" & TextBox14.Text & "','" & ComboBox6.Text & "','" & TextBox15.Text & "','" & TextBox16.Text & "','" & DateTimePicker4.Value.ToString("dd/MM/yyyy") & "','" & DateTimePicker5.Value.ToString("dd/MM/yyyy") & "','" & TextBox17.Text & "','" & TextBox18.Text & "','" & TextBox19.Text & "' ) "
cmd = New OleDb.OleDbCommand(statement, conn)
cmd.ExecuteNonQuery()
MsgBox("تمت عملية حفظ البيانات بنجاح ", vbInformation, "حفظ")
Call textclear()
conn.Close()
Form2.load_data()
Me.Close()
Form2.Show()
End If
End Sub