我继承了一些旧的 asp/vb 代码,它抛出了一个我找不到修复的错误。
服务器是 Windows Server 2008,运行 IIS7,SQL 服务器是 2008。
这是代码:
<% @ Language=VBScript %>
<!-- #include file="dsn.asp" -->
<!-- #include file="adovbs.inc" -->
<!-- #include file="libfunct.asp" -->
<%
'****************************************
' VARIABLES DECLARATION
'****************************************
Dim sSql, RsInsCoInfo, PolicyID, InsCo, InsOffice
Dim qsPolicyType, qsAttach, qsCLNT_ID, qsClientID
Dim CostArray(10)
Dim DescriptionArray(10)
'****************************************
' END VARIABLES DECLARATION
'****************************************
'********************************************
' RETRIEVING THE QUERYSTRINGS
'********************************************
qsAttach = Request.QueryString("Attach")
qsCLNT_ID = Request.QueryString("CLNT_ID")
qsClientID = Request.QueryString("ClientID")
qsPolicyType = Request.QueryString("PolicyType")
qsReQuote = Request.QueryString("ReQuote")
qsPolicyID = Request.QueryString("PolicyID")
'********************************************
' END RETRIEVING THE QUERYSTRINGS
'********************************************
'**********************************************
' RETRIEVING THE INSURANCE COMPANY DETAILS
'**********************************************
'Get the insurance company details
Set RsInsCoInfo = Server.CreateObject("ADODB.RecordSet")
sSQL = "SELECT InsuranceCo.*,FormPolicy.* FROM insuranceCo,FormPolicy"
sSQL = sSQL & " WHERE FormPolicy.INS_EF <= CONVERT(smalldatetime,'" & dbSaveDate(Date) & "',101)"
sSQL = sSQL & " And FormPolicy.INS_ET >= convert(smalldatetime,'" & dbSaveDate(Date) & "',101)"
sSQL = sSQL & " AND FormPolicy.PolicyType ='" & qsPolicyType & "'"
sSQL = sSQL & " AND InsuranceCo.INS_ID = FormPolicy.INS_ID"
'response.write ssql
'response.end
RsInsCoInfo.Open sSQL, OLEDBConnStr, adOpenStatic, adLockReadOnly, adCmdText
If Not RsInsCoInfo.EOF then
InsOffice = RsInsCoInfo("INS_Office")
InsCo = RsInsCoInfo("INS_DS")
Else
Response.write "<b>No underwriter available. Please contact the system administrator.<br>"
Response.write sSQL
Response.end
End if
'Close and free
RsInsCoInfo.close
Set RsInsCoInfo = Nothing
'**********************************************
' END RETRIEVING THE INSURANCE COMPANY DETAILS
'**********************************************
'*********************************************************************************
' CLIENT SEQUENCE NUMBER INCREMENT FOR THIS POLICY TYPE
'*********************************************************************************
If Not qsReQuote Then
newPolicyNumber = qsClientID & qsPolicyType
Set RsSequence = Server.CreateObject("ADODB.RecordSet")
sSQL = "SELECT * FROM Policy WHERE PolicyNumber like '%" & newPolicyNumber & "%' AND Clnt_ID=" & qsCLNT_ID
RsSequence.Open sSQL, OLEDBConnStr, adOpenStatic, adLockReadOnly, adCmdText
If RsSequence.recordcount > 0 then
PolicyID = 00
While not RsSequence.eof
If right(RsSequence("PolicyNumber"), 2) > PolicyID then
PolicyID = Cstr(right(RsSequence("PolicyNumber"), 2))
response.write PolicyID & "<br>"
End if
RsSequence.moveNext
Wend
PolicyID = PolicyID + 1
If PolicyID < 10 then
PolicyID = "0" & CStr(PolicyID)
End If
Else
PolicyID = "01"
End If
RsSequence.close
SET RsSequence = NOTHING
End If
'*********************************************************************************
' END CLIENT SEQUENCE NUMBER INCREMENT FOR THIS POLICY TYPE
'*********************************************************************************
'*********************************************************************************
' UPDATING ADDITIONNAL FIELD TO THE QUOTE CREATION
'*********************************************************************************
'Setting var
Dim strConnection, SQL_Upsate, newPolicyNumber
newPolicyNumber = qsClientID & qsPolicyType & PolicyID
If Not qsReQuote Then
'Insert Sql Statement
SQL_Update = "UPDATE Policy SET CLNT_ID=" & qsCLNT_ID & ","
SQL_Update = SQL_Update & " InsuranceCo='"& InsCo & "',"
SQL_Update = SQL_Update & " Office='"& InsOffice & "',"
SQL_Update = SQL_Update & " StatusID="& 0 & ","
SQL_Update = SQL_Update & " PolicyNumber='" & newPolicyNumber & "'"
SQL_Update = SQL_Update & " WHERE PolicyID=" & qsAttach
Else
'Insert Sql Statement
SQL_Update = "UPDATE Policy SET CLNT_ID=" & qsCLNT_ID & ","
SQL_Update = SQL_Update & " InsuranceCo='"& InsCo & "',"
SQL_Update = SQL_Update & " Office='"& InsOffice & "',"
SQL_Update = SQL_Update & " StatusID="& 0
SQL_Update = SQL_Update & " WHERE PolicyID=" & qsPolicyID
End If
'Connection object and open the db
Set strConnection = Server.CreateObject("ADODB.Connection")
strConnection.Open OLEDBConnStr
' Executing the sql insert
strConnection.Execute SQL_Update
'Now Close the connection and free up
strConnection.Close
Set strConnection = Nothing
'*********************************************************************************
' END ADDING ADDITIONAL FIELDS TO THE QUOTE CREATION
'*********************************************************************************
'*********************************************************************************
' DO CALCULATION
' - obtains file named Policy & 'Calculations.inc' = HHCalculations.inc etc.
'
' Modified by Stuart 20/5/03
'*********************************************************************************
set Rs = Server.CreateObject("ADODB.Recordset")
If Not qsReQuote Then
sSQL = "SELECT Policy.* FROM Policy WHERE Policy.PolicyID=" & qsAttach
Else
sSQL = "SELECT Policy.* FROM Policy WHERE Policy.PolicyID=" & qsPolicyID
End If
Rs.Open sSQL, OLEDBConnStr, adOpenkeyset, adLockPessimistic, adCmdText
'********************************************
'Response.write "<B>Policy table For Testing Only<P></b>"
'For Each fld in Rs.fields
' Response.write fld.name & " = " & fld.value & "<br>"
'Next
'Response.end
'**********************************************
Agent = 0
Agent2 = 0
AgentIntro = 0
'Open rsAccount for writing account entries to the PolicyAmount table
'** Comment derek to Stuart -> wont we be better here to find the agent with the code?
If Session("Agent") <> "" then
set RsAgent = Server.CreateObject("ADODB.Recordset")
sSQL = "Select * from Agents Where Name = '" & Session("Agent") & "'"
RsAgent.Open sSQL, OLEDBConnStr, adOpenkeyset, adLockPessimistic, adCmdText
Agent = rsAgent("commission")
End if
'If a park was involved for a new business then the introductory rate is required.
If Session("Village_Name") <> "" then
set RsPark = Server.CreateObject("ADODB.Recordset")
If IsNumeric(Session("Village_Name")) Then
sSQL = "Select * from Park Where ParkID = '" & Session("Village_Name") & "'"
Else
sSQL = "Select * from Park Where ParkID = '" & Session("reParkID") & "'"
End If
RsPark.Open sSQL, OLEDBConnStr, adOpenkeyset, adLockPessimistic, adCmdText
If RsPark.eof then
Response.write "<b>" & ssql & "<P>No Park record found - Line 189 QuoteSave2.asp<P>Please contact you system administrator."
'Response.end
Else
AgentIntro = RsPark("Introduction")
End if
End if
set RsAccount = Server.CreateObject("ADODB.Recordset")
set RsQuestions = Server.CreateObject("ADODB.Recordset")
If Not qsReQuote Then
sSQL = "SELECT * FROM PolicyAmount WHERE PolicyID=" & qsAttach
Else
sSQL = "SELECT * FROM PolicyAmount WHERE PolicyID=" & qsPolicyID
End If
RsAccount.Open sSQL, OLEDBConnStr, adOpenkeyset, adLockPessimistic, adCmdText
If Not qsReQuote Then
sSQL = "SELECT * FROM PolicyQuestions WHERE PolicyID=" & qsAttach
Else
sSQL = "SELECT * FROM PolicyQuestions WHERE PolicyID=" & qsPolicyID
End If
RsQuestions.Open sSQL, OLEDBConnStr, adOpenkeyset, adLockPessimistic, adCmdText
If Not qsRequote Then
RsAccount.Addnew
End If
If Not qsRequote Then
RsAccount("PolicyID") = qsAttach
linkID = qsAttach
Else
RsAccount("PolicyID") = qsPolicyID
linkID = qsPolicyID
End If
sTargetFile = qsPolicyType & "Calculations.inc"
sTargetFileContents = GetFileContentsForExecution(sTargetFile)
Execute sTargetFileContents
'*********************************************************************************
' END DO CALCULATION
'*********************************************************************************
'*********************************************************************************
' WRITE COSTS TO THE TABLE
'*********************************************************************************
'Update data to the PolicyAmount table
RsAccount("PolicyAmount_IB") = Session("Login")
RsAccount("PolicyAmount_IT") = Date
RsAccount.Update
'**********************************************
'Response.write "<P><B>PolicyAmount table For Testing Only<P></b>"
'For Each fld in RsAccount.fields
' Response.write fld.name & " = " & fld.value & "<br>"
'Next
'Response.write "<P><B><a href='default.asp'>Home</a>"
'Response.end
'***********************************************
'Clean up
RsAccount.Close
Set RsAccount = Nothing
Rs.update
Rs.Close
Set Rs = Nothing
RsQuestions.Close
Set RsQuestions = Nothing
'RsPark.close
'Set RsPark = Nothing
'Finish with this second saving so redirect to the policy page
If Not qsReQuote Then
Response.redirect "Policy.asp?PolicyID=" & qsAttach & "&CLNT_ID=" & qsCLNT_ID & "&ClientID=" & qsClientID & "&PolicyType=" & qsPolicyType
Else
Response.redirect "Policy.asp?PolicyID=" & qsPolicyID & "&CLNT_ID=" & qsCLNT_ID & "&ClientID=" & qsClientID & "&PolicyType=" & qsPolicyType
End If
%>
这是错误:“警告:文件 /quotesave2.asp 第 0 行多步 OLE DB 操作生成错误。检查每个 OLE DB 状态值(如果可用)。没有完成任何工作......”
它真的没有给我太多继续,任何帮助/见解将不胜感激。谢谢。