HOME
|
|
<%
Dim strConnString
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("db1.mdb") & ";"
Const DATE_DELIMITER = "'"
Dim cnnFormToDB ' CONN object
Dim strSQL ' String in which to build our SQL command
Dim lngRecsAffected ' # of records affected... just informational
Dim mname ' text field
Dim morganisation ' integer field
Dim mphone ' date field
Dim strErrorMsg ' Holds error message if we catch any problems.
If Request.Form("action") <> "Save Form Data" Then
%>
<%
Else
mname = Request.Form("txtname")
morganisation = Request.Form("txtorganisation")
mphone = Request.Form("txtphone")
mfax = Request.Form("txtfax")
memail = Request.Form("txtemail")
mmatter = Request.Form("txtmatter")
strErrorMsg = ""
strTextField = Trim(strTextField)
'strTextField = Replace(strTextField, "'", "''")
'intIntegerField = Replace(intIntegerField, "'", "''")
'datDateTimeField = Replace(datDateTimeField, "'", "''")
If strErrorMsg <> "" Then
' Show the error message that got us here!
Response.Write strErrorMsg
Else
' Open connection to the DB
Set cnnFormToDB = Server.CreateObject("ADODB.Connection")
cnnFormToDB.Open strConnString
strSQL = ""
strSQL = strSQL & "INSERT INTO feedback "
strSQL = strSQL & "(name,organisation,phone,fax,email,matter) " & vbCrLf
strSQL = strSQL & "VALUES ("
strSQL = strSQL & "'" & mname & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "'" & morganisation & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "'" & mphone & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "'" & mfax & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "'" & memail & "'"
strSQL = strSQL & ", "
strSQL = strSQL & "'" & mmatter & "'"
strSQL = strSQL & ");"
cnnFormToDB.Execute strSQL, lngRecsAffected, adCmdText Or adExecuteNoRecords
cnnFormToDB.Close
Set cnnFormToDB = Nothing
' Display a verification message and we're done!
%>
<%
End If
End If
%>
|
|