这是我为数据库课程做项目的第一个问题。我已经填写了一个表格来插入员工数据
这是代码
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
错误信息:
System.Data.dll中出现未处理的“System.Data.OleDb.OleDbException”类型异常
其他信息:溢出