<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsAddComments 'Holds the recordset for the new record to be added to the database
Dim strSQL 'Holds the SQL query for the database
dim fehlerbeschreibung
dim fehlerursache
dim kommentar
dim ID
dim namebehoben
dim namegemeldet
dim datumbehoben
dim betrkomp1
dim betrkomp2
dim betrkomp3
dim betrkomp4
dim sonstigekomponenten
dim neuekomponenten
dim client
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../CIM-Stoerungen.mdb")
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"
'Create an ADO recordset object
Set rsAddComments = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT Stoerungen.client, Stoerungen.Fehlerbeschreibung, Stoerungen.Kommentar, Stoerungen.Fehlerursache, Stoerungen.ID, Stoerungen.NameBehoben, Stoerungen.NameGemeldet, Stoerungen.Client, Stoerungen.sonstigeKomponente, Stoerungen.NeueKomponenten, Stoerungen.DatumGemeldet, Stoerungen.DatumBehoben, Stoerungen.BetrKomp1, Stoerungen.BetrKomp2, Stoerungen.BetrKomp3, Stoerungen.BetrKomp4, Stoerungen.Behoben, Stoerungen.inArbeit, Stoerungen.Gemeldet, Stoerungen.Kritisch, Stoerungen.OhneEffekt, Stoerungen.Störend FROM Stoerungen;"
'Set the cursor type we are using so we can navigate through the recordset
rsAddComments.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rsAddComments.LockType = 3
'Open the tblComments table using the SQL query held in the strSQL varaiable
rsAddComments.Open strSQL, adoCon
'Tell the recordset we are adding a new record to it
rsAddComments.AddNew
fehlerursache = Request.Form("fehlerursache")
kommetar = Request.Form("kommentar")
namegemeldet = Request.Form("namegemeldet")
namebehoben = Request.Form("namebehoben")
fehlerbeschreibung = Request.Form("fehlerbeschreibung")
datumbehoben = Request.Form("datumbehoben")
betrkomp1 = Request.Form("betrkomp1")
betrkomp2 = Request.Form("betrkomp2")
betrkomp3 = Request.Form("betrkomp3")
betrkomp4 = Request.Form("betrkomp4")
neuekomponenten = Request.Form("neuekomponenten")
sonstigekomponenten = Request.Form("sonstigekomponente")
client = request.form("client")
if fehlerursache = "" then
fehlerursache = "-"
end if
if kommentar = "" then
kommentar = "-"
end if
if namebehoben = "" then
namebehoben ="-"
end if
if datumbehoben = "" then
datumbehoben ="-"
end if
if betrkomp2 = "" then
betrkomp2 = "-"
end if
if betrkomp3 = "" then
betrkomp3 = "-"
end if
if betrkomp4 = "" then
betrkomp4 = "-"
end if
if betrkomp1 = "" then
betrkomp1 = "-"
end if
if neuekomponenten = "" then
neuekomponenten = "-"
end if
if sonstigekomponenten = "" then
sonstigekomponenten = "-"
end if
if client = "" then
client = "-"
end if
if fehlerbeschreibung = "" then
error = "Alle Felder mit * müssen ausgefüllt sein"
response.write error
response.end
end if
if namegemeldet = "" then
error = "Alle Felder mit * müssen ausgefüllt sein"
response.write error
response.end
end if
'Add a new record to the recordset
rsAddComments.Fields("Fehlerursache") = fehlerursache
rsAddComments.Fields("Kommentar") = kommentar
rsAddComments.Fields("NameGemeldet") = namegemeldet
rsAddComments.Fields("namebehoben") = namebehoben
'rsAddComments.fields("behoben") = Request.Form("Status")
'rsAddComments.Fields("inarbeit") = Request.Form("inarbeit")
'rsAddComments.Fields("gemeldet") = Request.Form("gemeldet")
'rsAddComments.Fields("kritisch") = Request.Form("kritisch")
rsAddComments.Fields("Fehlerbeschreibung") = fehlerbeschreibung
'rsAddComments.Fields("stoerend") = Request.Form("stoerend")
'rsAddComments.Fields("ohneeffekt") = Request.Form("ohneeffekt")
rsAddComments.Fields("datumgemeldet") = FormatDateTime(Now(),vbLongDate)
rsAddComments.Fields("datumbehoben") = datumbehoben
rsAddComments.Fields("betrkomp1") = betrkomp1
rsAddComments.Fields("betrkomp2") = betrkomp2
rsAddComments.Fields("betrkomp3") = betrkomp3
rsAddComments.Fields("betrkomp4") = betrkomp4
rsAddComments.Fields("neuekomponenten") = Rneuekomponenten
rsAddComments.Fields("sonstigekomponente") = sonstigekomponenten
rsaddcomments.fields("client") = client
'Write the updated recordset to the database
rsAddComments.Update
'Reset server objects
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing
'Redirect to the guestbook.asp page
Response.Redirect "alleanzeigen.asp"
%>