This is the original stored procedure (it works fine):
CREATE PROCEDURE some_procedure
@some_variable int
AS
SELECT DISTINCT T2.FieldOne, T1.FieldTwo, T1.FieldThree, T1.FieldFour, T1.FieldFive, T1.FieldEight, T1.FieldNine, T3.FieldTen, T3.FieldEleven, T3.FieldTwelve, T4.FieldThirteen
FROM T_TABLE1 T1
INNER JOIN T_TABLE2 T2 ON T1.FIELDFOURTEEN = T2.FIELDFOURTEEN
INNER JOIN T_TABLE3 T3 ON T1.FIELDFIFTEEN= T3.FIELDFIFTEEN
INNER JOIN T_TABLE4 T4 ON T1.FIELDNINE = T4.FIELDNINE
WHERE T1.FieldEight = T4.FieldEight
AND T1.PKEY = @some_variable
GO
Here is the code in the ASP page that uses the above stored procedure (it works great too):
<%
strsql = "exec some_procedure'"& (some_variable) & "'"
Set SQLresults = objConn.Execute(strSQL)
If Not SQLresults.EOF Then
Response.Cookies("ch")("co
okie1") = SQLresults("FieldOne")
Response.Cookies("ch")(" cookie2") = SQLresults("FieldTwo")
Response.Cookies("ch")(" cookie3") = SQLresults("FieldThree")
Response.Cookies("ch")(" cookie4") = SQLresults("FieldFour")
Response.Cookies("ch")(" cookie5") = SQLresults("FieldFive")
Response.Cookies("ch")(" cookie6") = SQLresults("FieldEight")
Response.Cookies("ch")(" cookie7) = SQLresults("FieldNine")
Response.Cookies("ch")(" cookie8) = SQLresults("FieldTen")
Response.Cookies("ch")(" cookie9) = SQLresults("FieldEleven")
Response.Cookies("ch")(" cookie10 = SQLresults("FieldTwelve")
Response.Cookies("ch")(" cookie11 = SQLresults("FieldThirteen"
)
elseif SQLresults.EOF = true then
End If
%>
I just need two more fields, but cannot change the stored procedure at this time. I'm trying to hardcode it into the page instead (see below), but it doesn't work.
<%
sStr = "SELECT DISTINCT FieldSix, FieldSeven "
sStr = sStr & "FROM T_TABLE1"
sStr = sStr & "WHERE T_TABLE1.PKEY = @some_variable "
set namephone = Server.CreateObject("ADODB
.Recordset
")
with namephone
.ActiveConnection = objConn
.CursorLocation = 3
.CursorType = 0
.LockType = 2
.Source = SSTR
.Open
Do Until .EOF
contactsplit = split(SQLresults("FIELDSIX
"))
if ubound(contactsplit) <> 0 then
contactleft = left(contactsplit(ubound(c
ontactspli
t)),1) & "."
redim preserve contactsplit(ubound(contac
tsplit)-1)
contactright = join(contactsplit)
erase contactsplit
Response.Cookies("ch")(" cookie12 = contactright & " " & contactleft
else
Response.Cookies("ch")(" cookie13 = contactsplit(0)
end if
Response.Cookies("ch")(" cookie14 = (SQLresults("FieldSeven"))
.MoveNext
Loop
End with
Set namephone = Nothing
%>
Start Free Trial