0

This is my first issue with doing a project for a database course. I've done a form to insert an employee data

This is the code

Public Class formAddLawyer
    Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs)
        FormatDateTime()
    End Sub

    Private Sub FormatDateTime()
        Throw New NotImplementedException()
    End Sub

    Private Sub btnBack_Click(sender As Object, e As EventArgs) Handles btnBack.Click
        Me.Hide()
    End Sub

    Private Sub formAddLawyer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        myConnection = New OleDb.OleDbConnection
        Cs = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Mohammed\Desktop\كلية الحاسب\LawOfficeDB.accdb"
        myConnection.ConnectionString = Cs
        myConnection.Open()
    End Sub

    Private Sub btnDoAdd_Click(sender As Object, e As EventArgs) Handles btnDoAdd.Click
        mySql = "Insert into tbl_lawyer (NID, LawyerFirstName, LawyerLastName, DateOfBirth, Salary, LawyerPhone, Address) Values ("
        mySql = mySql & "" & txtLID.Text & ",'" & txtLFN.Text & "','" & txtLLN.Text & "','" & LDOB.Text & "'," & txtSalary.Text & "," & txtLPhone.Text & ",'" & txtLAddress.Text & "')"

        cmd = New OleDb.OleDbCommand
        cmd.CommandText = mySql
        cmd.Connection = myConnection
        Answer = cmd.ExecuteNonQuery()
    End Sub

    Private Sub txtLPhone_TextChanged(sender As Object, e As EventArgs) Handles txtLPhone.TextChanged

    End Sub
End Class

Error information:

An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll

Additional information: Overflow

Community
  • 1
  • 1

0 Answers0