<%
'
'    Filename: mld_dienstniveaurecord3.asp
'    Generated with CodeCharge 2.0.5
'    ASP 2.0 & Templates.ccp build 11/30/2001
'

'-------------------------------
' 
' mld_dienstniveaurecord3 CustomIncludes Event begin
%>
<!-- #INCLUDE FILE="Common.asp" -->
<%
' mld_dienstniveaurecord3 CustomIncludes Event end


'===============================
' Save Page and File Name available into variables
'-------------------------------
sFileName = "mld_dienstniveaurecord3.asp"
sTemplateFileName = "mld_dienstniveaurecord3.html"
'===============================


'===============================
' mld_dienstniveaurecord3 PageSecurity begin
' mld_dienstniveaurecord3 PageSecurity end
'===============================

'===============================
' mld_dienstniveaurecord3 Open Event begin
' mld_dienstniveaurecord3 Open Event end
'===============================

'===============================
' mld_dienstniveaurecord3 OpenAnyPage Event begin
' mld_dienstniveaurecord3 OpenAnyPage Event end
'===============================

'===============================
'Save the name of the form and type of action into the variables
'-------------------------------
sAction = GetParam("FormAction")
sForm = GetParam("FormName")
'===============================

' mld_dienstniveaurecord3 Show begin
'===============================
' Perform the form's action
'-------------------------------
' Initialize error variables
'-------------------------------
smld_dienstniveauRecordErr = ""

'-------------------------------
' Select the FormAction
'-------------------------------
Select Case sForm
  Case "mld_dienstniveauRecord"
    mld_dienstniveauRecordAction(sAction)
end select
'===============================

'===============================
' Display page
'-------------------------------
' Load HTML template for this page
'-------------------------------
LoadTemplate sAppPath & sTemplateFileName, "main"
'-------------------------------
' Load HTML template of Header and Footer
'-------------------------------
'-------------------------------
SetVar "FileName", sFileName


'-------------------------------
' Step through each form
'-------------------------------
mld_dienstniveauRecord_Show
'-------------------------------
' Process page templates
'-------------------------------
Parse "main", False
'-------------------------------
' Output the page to the browser
'-------------------------------
Response.write PrintVar("main")

' mld_dienstniveaurecord3 Show end

'-------------------------------
' Destroy all object variables
'-------------------------------

' mld_dienstniveaurecord3 Close Event begin
' mld_dienstniveaurecord3 Close Event end

cn.Close
Set cn = Nothing
UnloadTemplate
'===============================
'===============================
' Action of the Record Form
'-------------------------------
Sub mld_dienstniveauRecordAction(sAction)
'-------------------------------
' Initialize variables  
'-------------------------------
  Dim bExecSQL: bExecSQL = true
  Dim sActionFileName : sActionFileName = ""
  Dim sWhere : sWhere = "" 
  Dim bErr : bErr = False
  Dim pPKMLD_DIENSTNIVEAU_KEY : pPKMLD_DIENSTNIVEAU_KEY = ""
  Dim fldMLD_DIENSTNIVEAU_OMSCHR : fldMLD_DIENSTNIVEAU_OMSCHR = ""
  Dim fldMLD_DIENSTNIVEAU_OPMERKING : fldMLD_DIENSTNIVEAU_OPMERKING = ""
'-------------------------------

'-------------------------------
' mld_dienstniveauRecord Action begin
'-------------------------------
  sActionFileName = "mld_dienstniveaugrid.asp"

'-------------------------------
' CANCEL action
'-------------------------------
  if sAction = "cancel" then

'-------------------------------
' mld_dienstniveauRecord BeforeCancel Event begin
' mld_dienstniveauRecord BeforeCancel Event end
'-------------------------------
    cn.Close
    Set cn = Nothing
    response.redirect sActionFileName
  end if
'-------------------------------

'-------------------------------
' Load all form fields into variables
'-------------------------------
  fldMLD_DIENSTNIVEAU_OMSCHR = GetParam("MLD_DIENSTNIVEAU_OMSCHR")
  fldMLD_DIENSTNIVEAU_OPMERKING = GetParam("MLD_DIENSTNIVEAU_OPMERKING")

'-------------------------------
' Validate fields
'-------------------------------
  if sAction = "insert" or sAction = "update" then
'-------------------------------
' mld_dienstniveauRecord Check Event begin
' mld_dienstniveauRecord Check Event end
'-------------------------------
    If len(smld_dienstniveauRecordErr) > 0 then
      exit sub
    end if
  end if
'-------------------------------


'-------------------------------
' Create SQL statement
'-------------------------------
  select case sAction
    case "insert"
'-------------------------------
' mld_dienstniveauRecord Insert Event begin
' mld_dienstniveauRecord Insert Event end
'-------------------------------
      sSQL = "insert into MLD_DIENSTNIVEAU (" & _
          "MLD_DIENSTNIVEAU_OMSCHR," & _
          "MLD_DIENSTNIVEAU_OPMERKING)" & _
          " values (" & _
          ToSQL(fldMLD_DIENSTNIVEAU_OMSCHR, "Text") & "," & _
          ToSQL(fldMLD_DIENSTNIVEAU_OPMERKING, "Text") & _
          ")"
  end select
'-------------------------------
'-------------------------------
' mld_dienstniveauRecord BeforeExecute Event begin
' mld_dienstniveauRecord BeforeExecute Event end
'-------------------------------

'-------------------------------
' Execute SQL statement
'-------------------------------
if len(smld_dienstniveauRecordErr) > 0 then Exit Sub
  on error resume next
  if bExecSQL then 
    cn.execute sSQL
  end if
  smld_dienstniveauRecordErr = ProcessError
  on error goto 0
  if len(smld_dienstniveauRecordErr) > 0 then Exit Sub
  cn.Close
  Set cn = Nothing
  response.redirect sActionFileName
'-------------------------------
' mld_dienstniveauRecord Action end
'-------------------------------
end sub
'===============================

'===============================
' Display Record Form
'-------------------------------
Sub mld_dienstniveauRecord_Show()
'-------------------------------
' mld_dienstniveauRecord Show begin
'-------------------------------
  Dim sWhere : sWhere = ""
  Dim sFormTitle: sFormTitle = "Details dienstniveau"
  Dim bPK : bPK = True

'-------------------------------
' Load primary key and form parameters
'-------------------------------
  if smld_dienstniveauRecordErr = "" then
    pMLD_DIENSTNIVEAU_KEY = GetParam("MLD_DIENSTNIVEAU_KEY")
    SetVar "mld_dienstniveauRecordError", ""
  else
    fldMLD_DIENSTNIVEAU_OMSCHR = GetParam("MLD_DIENSTNIVEAU_OMSCHR")
    fldMLD_DIENSTNIVEAU_OPMERKING = GetParam("MLD_DIENSTNIVEAU_OPMERKING")
    pMLD_DIENSTNIVEAU_KEY = GetParam("PK_MLD_DIENSTNIVEAU_KEY")
    SetVar "smld_dienstniveauRecordErr", smld_dienstniveauRecordErr
    SetVar "FormTitle", sFormTitle
    Parse "mld_dienstniveauRecordError", False
  end if
'-------------------------------

'-------------------------------
' Load all form fields

'-------------------------------

'-------------------------------
' Build WHERE statement

  if IsEmpty(pMLD_DIENSTNIVEAU_KEY) then bPK = False
  
  sWhere = sWhere & "MLD_DIENSTNIVEAU_KEY=" & ToSQL(pMLD_DIENSTNIVEAU_KEY, "Number")
  SetVar "PK_MLD_DIENSTNIVEAU_KEY", pMLD_DIENSTNIVEAU_KEY
'-------------------------------
'-------------------------------
' mld_dienstniveauRecord Open Event begin
' mld_dienstniveauRecord Open Event end
'-------------------------------

  SetVar "FormTitle", sFormTitle

'-------------------------------
' Build SQL statement and open recordset
'-------------------------------
  sSQL = "select * from MLD_DIENSTNIVEAU where " & sWhere
  openrs rs, sSQL
  bIsUpdateMode = (bPK and not(sAction = "insert" and sForm = "mld_dienstniveauRecord") and not rs.eof)
'-------------------------------

'-------------------------------
' Load all fields into variables from recordset or input parameters
'-------------------------------
  if bIsUpdateMode then
    fldMLD_DIENSTNIVEAU_KEY = GetValue(rs, "MLD_DIENSTNIVEAU_KEY")

'-------------------------------
' Load data from recordset when form displayed first time
'-------------------------------
    if smld_dienstniveauRecordErr = "" then
      fldMLD_DIENSTNIVEAU_OMSCHR = GetValue(rs, "MLD_DIENSTNIVEAU_OMSCHR")
      fldMLD_DIENSTNIVEAU_OPMERKING = GetValue(rs, "MLD_DIENSTNIVEAU_OPMERKING")
    end if
    SetVar "mld_dienstniveauRecordDelete", ""
    SetVar "mld_dienstniveauRecordUpdate", ""
    SetVar "mld_dienstniveauRecordInsert", ""
'-------------------------------
' mld_dienstniveauRecord ShowEdit Event begin
' mld_dienstniveauRecord ShowEdit Event end
'-------------------------------
  else
    SetVar "mld_dienstniveauRecordEdit", ""
    Parse "mld_dienstniveauRecordInsert", False
'-------------------------------
' mld_dienstniveauRecord ShowInsert Event begin
' mld_dienstniveauRecord ShowInsert Event end
'-------------------------------
  end if
  Parse "mld_dienstniveauRecordCancel", false
'-------------------------------
' mld_dienstniveauRecord Show Event begin
' mld_dienstniveauRecord Show Event end
'-------------------------------

'-------------------------------
' Show form field
'-------------------------------
      SetVar "MLD_DIENSTNIVEAU_KEY", ToHTML(fldMLD_DIENSTNIVEAU_KEY)
      SetVar "MLD_DIENSTNIVEAU_OMSCHR", ToHTML(fldMLD_DIENSTNIVEAU_OMSCHR)
      SetVar "MLD_DIENSTNIVEAU_OPMERKING", ToHTML(fldMLD_DIENSTNIVEAU_OPMERKING)
  Parse "Formmld_dienstniveauRecord", False

'-------------------------------
' mld_dienstniveauRecord Close Event begin
' mld_dienstniveauRecord Close Event end
'-------------------------------

Set rs = Nothing

'-------------------------------
' mld_dienstniveauRecord Show end
'-------------------------------
End Sub
'===============================
%>