% @LANGUAGE=VBSCRIPT %>
<%
If Session("logged") <> "1" Then
Response.Redirect("login.asp")
End If
%>
<%
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Properties("Data Source") = Server.Mappath("../db/db1.mdb")
conn.Open
If Request.Form("act") = "Add" Then
If Trim(Request.Form("manAbbNEW")) <> "" And Trim(Request.Form("manNameNEW")) <> "" Then
On Error Resume Next
conn.Execute "INSERT INTO tblABB (Abb, Manufacturer) VALUES ('" & _
Replace(Trim(Request.Form("manAbbNEW")), "'", "''") & "', '" & _
Replace(Trim(Request.Form("manNameNEW")), "'", "''") & "')"
If Err <> 0 Then
Response.Write "Such abbreviation already exists. Please enter another abbreviation
"
End If
End If
ElseIf Request.Form("act") = "Upd" Then
If Trim(Request.Form("manAbb")) <> "" And Trim(Request.Form("manName")) <> "" Then
On Error Resume Next
conn.Execute "UPDATE tblABB SET Abb = '" & _
Replace(Trim(Request.Form("manAbb")), "'", "''") & "', Manufacturer = '" & _
Replace(Trim(Request.Form("manName")), "'", "''") & "' WHERE " & _
" Abb = '" & Request.Form("manufacturer") & "'"
conn.Execute "UPDATE tblOEMParts SET Abb = '" & _
Replace(Trim(Request.Form("manAbb")), "'", "''") & "' " & _
" WHERE Abb = '" & Request.Form("manufacturer") & "'"
If Err <> 0 Then
Response.Write "Such abbreviation already exists. Please enter another abbreviation
"
End If
End If
ElseIf Request.Form("act") = "Del" Then
conn.Execute "DELETE FROM tblUCParts WHERE OEMID IN (" & _
"SELECT OEMID FROM tblOEMParts WHERE Abb = '" & _
Request.Form("manufacturer") & "')"
conn.Execute "DELETE FROM tblOEMParts WHERE Abb = '" & Request.Form("manufacturer") & "'"
conn.Execute "DELETE FROM tblABB WHERE Abb = '" & Request.Form("manufacturer") & "'"
End If
%>