本文介绍了在经典的asp中使用命令对象和记录集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Quote:

设置dbConn = Server.CreateObject(ADODB.Connection)

set RS = server .CreateObject(ADODB.recordset)

dbConn.Open应用程序(SOP_DB_ConnectionString),_

应用程序(SOP_DB_RuntimeUserName),_

应用程序(SOP_DB_RuntimePassword)





设置cmdSQL = server.CreateObject(ADODB.command)







sqlStmt =select * from Parameters where parameter like?



cmdSQL.Activeconnection = dbConn

cmdSQL.CommandText = sqlStmt

cmdSQL.CommandType = adCmdText

cmdSQL.Prepared = True'只有在你打算经常重复使用这个命令时才需要

cmdSQL.Parameters.Refresh



strSearch =%conn%

设置prmSQL = cmdSQL.CreatePa rameter(strVal,adVarChar,adParamInput,255,strSearch)

cmdSQL.Parameters.Append prmSQL







RS.CursorType = 3'adOpenStatic





RS.Open cmdSQL,dbConn





如果RS.BOF和RS.EOF那么'如果没有找到连接 - > GETTING ERROR HERE

session(ErrorTitle)=初始化过程

session(ErrorText)=连接失败 - 无法读取SOP来自数据库的参数

Response.RedirectError.asp

else'找到记录

RS.MoveFirst

请不要RS.EOF

session(trim(RS.Fields(Parameter)。value))= Trim(RS.Fields(Val)。value)

RS.MoveNext

循环

结束如果

Rs.close

Set dbConn = Server.CreateObject("ADODB.Connection")
set RS = server.CreateObject("ADODB.recordset")
dbConn.Open Application("SOP_DB_ConnectionString"), _
Application("SOP_DB_RuntimeUserName"), _
Application("SOP_DB_RuntimePassword")


Set cmdSQL= server.CreateObject("ADODB.command")



sqlStmt = "select * from Parameters where Parameter like ?"

cmdSQL.Activeconnection = dbConn
cmdSQL.CommandText = sqlStmt
cmdSQL.CommandType = adCmdText
cmdSQL.Prepared = True ' only needed if u plan to reuse this command often
cmdSQL.Parameters.Refresh

strSearch = "%conn%"
Set prmSQL = cmdSQL.CreateParameter("strVal" , adVarChar, adParamInput, 255,strSearch)
cmdSQL.Parameters.Append prmSQL



RS.CursorType = 3' adOpenStatic


RS.Open cmdSQL,dbConn


if RS.BOF and RS.EOF then ' if no connection found -->GETTING ERROR HERE
session("ErrorTitle")="the initializing process"
session("ErrorText")="Connection failed- Couldn't read SOP parameters from database"
Response.Redirect "Error.asp"
else ' found record
RS.MoveFirst
Do while not RS.EOF
session(trim(RS.Fields("Parameter").value)) = Trim(RS.Fields("Val").value)
RS.MoveNext
Loop
end if
Rs.close







有人可以请帮我解决问题?




Can somebody help me please in fixing the issue ?

推荐答案


这篇关于在经典的asp中使用命令对象和记录集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 03:25