Is the way that I am
1) getting the return value,
2) verifying it,
3) then opening a recordset if the return code is successful,
4) returning resultset
the best way to do this? I am concerned with the cmd.Execute and the Set rs = cmd.Execute (calling it twice).
Thanks
function WV_GetQuotePortfolio(userid)
' replace qry_WVGetQuotePortfolio.cfm
dim cmd, rs, dbConn, retval
strConn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=flibble;Initial Catalog=WV_DEV;Network Address=GAINES-XE3-W2K"
Set dbConn = Server.CreateObject("ADODB.Connection"
dbConn.Open strConn
Set cmd = Server.CreateObject("ADODB.Command"
with cmd
.ActiveConnection = dbConn
.CommandText = "WVGetQuotePortfolio"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("RETURN_VALUE", adInteger,adParamReturnValue,4)
.Parameters.Append .CreateParameter("@userID",adInteger,adParamInput, ,userid)
.Execute
retval = .Parameters("RETURN_VALUE"
end with
if retval = 1 then
Response.Write("Invalid User"
else
Set rs = Server.CreateObject("ADODB.Recordset"
Set rs = cmd.Execute
do while not rs.EOF
Response.Write(rs("contract"
& "<br>"
rs.MoveNext
loop
CloseRS(rs)
end if
CloseCmd(cmd)
CloseDBConn(dbConn)
end function regards,
Brian
1) getting the return value,
2) verifying it,
3) then opening a recordset if the return code is successful,
4) returning resultset
the best way to do this? I am concerned with the cmd.Execute and the Set rs = cmd.Execute (calling it twice).
Thanks
function WV_GetQuotePortfolio(userid)
' replace qry_WVGetQuotePortfolio.cfm
dim cmd, rs, dbConn, retval
strConn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=flibble;Initial Catalog=WV_DEV;Network Address=GAINES-XE3-W2K"
Set dbConn = Server.CreateObject("ADODB.Connection"
dbConn.Open strConn
Set cmd = Server.CreateObject("ADODB.Command"
with cmd
.ActiveConnection = dbConn
.CommandText = "WVGetQuotePortfolio"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("RETURN_VALUE", adInteger,adParamReturnValue,4)
.Parameters.Append .CreateParameter("@userID",adInteger,adParamInput, ,userid)
.Execute
retval = .Parameters("RETURN_VALUE"
end with
if retval = 1 then
Response.Write("Invalid User"
else
Set rs = Server.CreateObject("ADODB.Recordset"
Set rs = cmd.Execute
do while not rs.EOF
Response.Write(rs("contract"
rs.MoveNext
loop
CloseRS(rs)
end if
CloseCmd(cmd)
CloseDBConn(dbConn)
end function regards,
Brian