HOME > ASP > ASP Forum > ช่วยแก้ไขหน่อย code คือ Error Type: Microsoft JET Database Engine (0x80040E21) You cannot add or change a record because a related record is required in table 'USER'.
ช่วยแก้ไขหน่อย code คือ Error Type: Microsoft JET Database Engine (0x80040E21) You cannot add or change a record because a related record is required in table 'USER'.
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("test_project_update.mdb")
Sql="Select * from employee where emp_id = " & Request.Form("emp_id")
Set RS =Server.CreateObject("ADODB.Recordset")
RS.open Sql,Conn,1,3
Sql1 = "INSERT INTO extra values(" & max_emp_id & ",'" & request.form("like") & "')"
'response.write(Sql1)
Set oCmd = Server.CreateObject("ADODB.Command")
Set oCmd.ActiveConnection = Conn
oCmd.CommandText = Sql1
oCmd.Execute
conn.close
if Session("Clearance")=1 then
response.redirect("employee.asp")
Else
response.redirect("employee.asp")
End if
else
response.redirect("error_insert_employee.asp")
end if
%>
-------------------------------------------------------------------------------------------------------------------------------------------
Error Type:
Microsoft JET Database Engine (0x80040E21)
You cannot add or change a record because a related record is required in table 'USER'.
/project2/insert_employee1.asp, line 22