<%@language=vbscript codepage=936 %>
<%
Option Explicit
Response.Buffer = True
%>
<!--#include file="../conn.asp"-->
<%
Dim ErrorMessage
ErrorMessage=""
Call main
If ErrorMessage="" Then
    Response.Write WriteSuccessMsg("提交成功，非常感谢您的参与！", "")
Else
    Response.Write WriteErrMsg(ErrorMessage, "SaveSurvey.asp")
End If
Call CloseConn

Sub main()
    On Error Resume Next
    Dim PE_Survey
    Set PE_Survey = Server.CreateObject("PE_Survey6.Survey")
    If Err Then
        Err.Clear
        Response.Write "对不起，你的服务器没有安装动易组件（PE_Survey6.dll），所以不能使用动易系统。请和你的空间商联系以安装动易组件。"
        Response.End
        Exit Sub
    End If
    PE_Survey.iConnStr = ConnStr
    PE_Survey.iSystemDatabaseType = SystemDatabaseType
    Call PE_Survey.Execute
    ErrorMessage = PE_Survey.ErrorMessage
    Set PE_Survey = Nothing
    If Err Then
        Response.Write "错 误 号：" & Err.Number & "<BR>"
        Response.Write "错误描述：" & Err.Description & "<BR>"
        Response.Write "错误来源：" & Err.Source & "<BR>"
        Err.Clear
        Response.End
    End If
End Sub

Function WriteErrMsg(sErrMsg, sComeUrl)
    Dim strMsg
    strMsg = strMsg & "<html><head><title>错误信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbCrLf
    strMsg = strMsg & "<link href='../images/Style.css' rel='stylesheet' type='text/css'></head><body><br><br>" & vbCrLf
    strMsg = strMsg & "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbCrLf
    strMsg = strMsg & "  <tr align='center' class='title'><td height='22'><strong>错误信息</strong></td></tr>" & vbCrLf
    strMsg = strMsg & "  <tr class='tdbg'><td height='100' valign='top'><b>产生错误的可能原因：</b>" & sErrMsg & "</td></tr>" & vbCrLf
    strMsg = strMsg & "  <tr align='center' class='tdbg'><td>"
    If sComeUrl <> "" Then
        strMsg = strMsg & "<a href='javascript:history.go(-1)'>&lt;&lt; 返回上一页</a>"
    Else
        strMsg = strMsg & "<a href='javascript:window.close();'>【关闭】</a>"
    End If
    strMsg = strMsg & "</td></tr>" & vbCrLf
    strMsg = strMsg & "</table>" & vbCrLf
    strMsg = strMsg & "</body></html>" & vbCrLf
    WriteErrMsg = strMsg
End Function

Function WriteSuccessMsg(sSuccessMsg, sComeUrl)
    Dim strMsg
    strMsg = strMsg & "<html><head><title>成功信息</title><meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & vbCrLf
    strMsg = strMsg & "<link href='../images/Style.css' rel='stylesheet' type='text/css'></head><body><br><br>" & vbCrLf
    strMsg = strMsg & "<table cellpadding=2 cellspacing=1 border=0 width=400 class='border' align=center>" & vbCrLf
    strMsg = strMsg & "  <tr align='center' class='title'><td height='22'><strong>恭喜你！</strong></td></tr>" & vbCrLf
    strMsg = strMsg & "  <tr class='tdbg'><td height='100' valign='top'><br>" & sSuccessMsg & "</td></tr>" & vbCrLf
    strMsg = strMsg & "  <tr align='center' class='tdbg'><td>"
    If sComeUrl <> "" Then
        strMsg = strMsg & "<a href='" & sComeUrl & "'>&lt;&lt; 返回上一页</a>"
    Else
        strMsg = strMsg & "<a href='javascript:window.close();'>【关闭】</a>"
    End If
    strMsg = strMsg & "</td></tr>" & vbCrLf
    strMsg = strMsg & "</table>" & vbCrLf
    strMsg = strMsg & "</body></html>" & vbCrLf
    WriteSuccessMsg = strMsg
End Function
%>