<%
Flag = request.form("Flag")
If IsEmpty(Flag) or Flag = "" then
%>
<%
End If
If Flag = 1 then
co = request("co")
name = request("name")
adress=request("adress")
if adress="" then
adress="此项未填"
end if
country=request("country")
if country="" then
country="此项未填"
end if
fax=request("fax")
if fax="" then
fax="此项未填"
end if
Email = request("Email")
tel=request("tel")
Comments = request("Comments")
Comments = Replace(Comments, Chr(34), "''")
Comments = Replace(Comments, vbCrLf, " ")
Flag = request.form("Flag")
%>
<%=name%>先生:
以下是你提交的信息,请确认 |
|
您的公司是:
|
<%= co %> |
|
您的名字是:
|
<%= name %> |
|
地 址: |
<%= adress %> |
|
国 家:
|
<%= country %> |
|
电 话:
|
<%= tel %> |
|
传 真:
|
<%= fax %> |
| E-mai:
|
<%= email %> |
|
您的要求/留言: |
|
|
|
|
|
<%
End If
If Flag = 2 then
Today = date()
co=request("co")
co = Replace(co, "'", "''")
co = Replace(co, Chr(34), "''")
Name = request.form("Name")
Name = Replace(Name, "'", "''")
Name = Replace(Name, Chr(34), "''")
adress = request.form("adress")
adress = Replace(adress, "'", "''")
tel = request.form("tel")
Country = request.form("Country")
Country = Replace(Country, "'", "''")
Email = request.form("Email")
fax = request.form("fax")
Comments = request.form("Comments")
Comments = Replace(Comments, "'", "''")
set conn = server.createobject("adodb.connection")
DBPath = Server.MapPath("dhdhd\7y63y6ye\d328383dkd28\23ddwrewe55" & ".mdb")
conn.connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;"&"Data source="&DBPath
conn.open
'如果用系统 DSN 来连接数据库,加上下句
' conn.Open "guestbook"
SQLstmt = "INSERT INTO lyb (co,Name,adress,Country,tel,fax,Email,Comments)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & co & "',"
SQLstmt = SQLstmt & "'" & Name & "',"
SQLstmt = SQLstmt & "'" & adress & "',"
SQLstmt = SQLstmt & "'" & country & "',"
SQLstmt = SQLstmt & "'" & tel & "',"
SQLstmt = SQLstmt & "'" & fax & "',"
SQLstmt = SQLstmt & "'" & email & "',"
SQLstmt = SQLstmt & "'" & Comments & "'"
'SQLstmt = SQLstmt & "'" & today & "'"
SQLstmt = SQLstmt & ")"
set rs=Server.CreateObject("adodb.Recordset")
rs.open SQLstmt,conn,3,3
If err.number>0 then
response.write "VBScript Errors Occured:" & ""
response.write "Error Number=" & err.number & " "
response.write "Error Descr.=" & err.description & " "
response.write "Help Context=" & err.helpcontext & " "
response.write "Help Path=" & err.helppath & " "
response.write "Native Error=" & err.nativeerror & " "
response.write "Source=" & err.source & " "
response.write "SQLState=" & err.sqlstate & " "
end if
IF conn.errors.count> 0 then
response.write "Database Errors Occured" & " "
response.write SQLstmt & " "
for counter= 0 to conn.errors.count
response.write "Error #" & conn.errors(counter).number & " "
response.write "Error desc. -> " & conn.errors(counter).description & " "
next
else
response.redirect "sucess.htm"
end if
Conn.Close
Set conn = nothing
End If
%>
|