|
|
|
Sorry,
you cannot run this page correctly with scripting turned
off. Please turn on JavaScript and then reopen the page.
|
<%
Public Function LoadData()
CommitmentDate = Request.form("commitdate")
CommitmentMetDate = Trim(Request.form("metdate"))
TelephoneExt = Trim(Request.form("ext"))
'Connect to the SQL Server Database
PMAConnect()
'Load the data into the database
Set myRS = Server.CreateObject("ADODB.Recordset")
mySQL = "Select * FROM WebCommitments"
if PMAConn = "True" then
myRS.Open mySQL, cnPMAData, adOpenKeyset, adLockOptimistic
myrs.AddNew
myRS("SeqNo") = Trim(Request.Form("SeqNo"))
myRS("Type") = trim(Request.Form("issuearea"))
myRS("CommitmentDate") = cdate(CommitmentDate)
myRS("CommitmentType") = Trim(Request.Form("committype"))
myRS("PartyResponsible") = Trim(Request.Form("party"))
if CommitmentMetDate <> "" then
myRS("CommitmentMetDate") = cdate(CommitmentMetDate)
end if
myRS("RecordEnteredby") = Trim(Request.Form("enterby"))
myRS("CommitmentTo") = Trim(Request.Form("committo"))
myRS("PartiesAffected") = Trim(Request.Form("partiesaffected"))
myRS("CommitmentDescription") = Trim(Request.Form("description"))
myRS("NameCompany") = Trim(Request.Form("namecompany"))
If TelephoneExt = "" then
myRS("Telephone") = "(" & Trim(Request.Form("Phone")) & ") " & Trim(Request.Form("Phone1")) & "-" & Trim(Request.Form("Phone2"))
else
myRS("Telephone") = "(" & Trim(Request.Form("Phone")) & ") " & Trim(Request.Form("Phone1")) & "-" & Trim(Request.Form("Phone2")) & " ext. " & Trim(Request.Form("ext"))
End If
myRS("Comments") = Trim(Request.Form("Comments"))
myRS.Update
end if
Set myRS = nothing
Set cnPMAData = nothing
End Function
Function PMAConnect()
'Instruct VBScript to ignore the error and continue
'with the next line of code
On Error Resume Next
'Create and open the database object
Set cnPMAData=Server.CreateObject("ADODB.Connection")
cnPMAData.Open ConnString
If cnPMAData.Errors.Count > 0 then
'Create an error object to access the ADO error collection
Set objErr = Server.CreateObject("ADODB.Error")
'Declare boolean flag for critical errors
Dim blnCriticalError
'Write all errors to the page
For Each objErr In cnPMAData.Errors
If objErr.Number <> 0 then
Response.Write "Number: " & objErr.Number & ""
Response.Write "Description: " & objErr.Description & " "
Response.Write "Source: " & objErr.Source & " "
Response.Write "SQLState: " & objErr.SQLState & " "
Response.Write "NativeError: " & objErr.NativeError & " "
blnCriticalError = True
End If
Next
'Dereference all object
Set objErr = Nothing
If blnCriticalError then
PMAConn = "False"
Response.End
Else
PMAConn = "True"
End If
Else
PMAConn = "True"
End If
End Function
%>
|
|