
مكن احد يقول لي شنو الخطا اللي طلع في الرساله
هذا كود button
Dim _Ginder As String
If RadioButton1.Checked = True Then
_Ginder = "Male"
Else
_Ginder = "Female"
End If
Try
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source =" & _
Application.StartupPath & "\db1.mdb"
Dim Conn As New OleDbConnection(ConStr)
Dim SavInto As New OleDb.OleDbCommand
Conn.Open()
SavInto.Connection = Conn
SavInto.CommandText = "Insert into Table1(First Name,Last Name,CPR,Reason,Gendor,Join Date) values (@First Name,@Last Name,@CPR,@Reason,@Gendor,@Join Date)"
SavInto.Parameters.AddWithValue("@First Name", TextBox1.Text)
SavInto.Parameters.AddWithValue("@Last Name", TextBox2.Text)
SavInto.Parameters.AddWithValue("@CPR", TextBox3.Text)
SavInto.Parameters.AddWithValue("@Reason", ComboBox1.SelectedItem.ToString())
SavInto.Parameters.AddWithValue("@Gendor", _Ginder.ToString())
SavInto.Parameters.AddWithValue("@Join Date", DateTimePicker1.Text.ToString())
SavInto.ExecuteNonQuery()
Conn.Close()
MsgBox("Add Succeeded")
Me.Close()
frm1.Show()
Catch ex As Exception
MsgBox(ex.ToString())
End Try