response buffer clearing ADO cache?
response buffer clearing ADO cache?
am 29.11.2007 19:22:13 von Pierre-Andre van Leeuwen
Hi All: I have a bizarre problem I've never encountered before, and hope
this is the correct place to post it. I believe it's an IIS issue, although
it could be an ADO issue...I hope someone can help me figure it out!
I'm on IIS 6 on Server2003 web edition sp2.
I have some VBScript code where I open an ADODB recordset, and then loop
through it and response.write back some values from the recordset. Very
simple, been doing it for a million years, and the exact code has been
running on several different servers for years without a problem.
code looks something like:
<%
sql = "SELECT * FROM mytable " &_
"WHERE myval = " & myval
set rstemp = conn.Execute (sql)
do while not rstemp.eof
response.write "my val: " & rstemp("myval") & "
"
rstemp.movenext
loop
rstemp.close
%>
And that would work normally. rstemp("myval") is a varchar field in the
database btw.
What I discovered, however, was this response.write was clearing whatever
buffer the recordset value was being held in. For example, if I repeated the
code, like:
response.write "my val: " & rstemp("myval") & "
"
response.write "my val2: " & rstemp("myval") & "
"
I would only see the first iteration of rstemp("myval"). The second line
would just have "my val2:" on it with nothing following it!
Furthermore, I'm pretty sure rstemp("myval") is null after the first
response.write...trying to run any string function on it returns an error.
I even replaced the code above with
response.write "my val: " & rstemp("myval") & rstemp("myval")
and I only see one instance of the var...help? What would cause the
recordset to lose it's persistence like that?
--
Re: response buffer clearing ADO cache?
am 30.11.2007 11:04:29 von David Wang
Is the issue really caused by response.write?
If you assign rstemp("myval") to another variable and response.write
that variable twice, does that variable become null?
If you assign rstemp("myval") to two different variables, does it
become null?
Is this on 32bit or 64bit Windows and what is the bitness of the
worker process running your ASP page.
//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//
On Nov 29, 10:22 am, "geek-y-guy" wrote:
> Hi All: I have a bizarre problem I've never encountered before, and hope
> this is the correct place to post it. I believe it's an IIS issue, although
> it could be an ADO issue...I hope someone can help me figure it out!
>
> I'm on IIS 6 on Server2003 web edition sp2.
>
> I have some VBScript code where I open an ADODB recordset, and then loop
> through it and response.write back some values from the recordset. Very
> simple, been doing it for a million years, and the exact code has been
> running on several different servers for years without a problem.
>
> code looks something like:
>
> <%
> sql = "SELECT * FROM mytable " &_
> "WHERE myval = " & myval
> set rstemp = conn.Execute (sql)
> do while not rstemp.eof
>
> response.write "my val: " & rstemp("myval") & "
"
>
> rstemp.movenext
> loop
>
> rstemp.close
> %>
>
> And that would work normally. rstemp("myval") is a varchar field in the
> database btw.
>
> What I discovered, however, was this response.write was clearing whatever
> buffer the recordset value was being held in. For example, if I repeated the
> code, like:
>
> response.write "my val: " & rstemp("myval") & "
"
> response.write "my val2: " & rstemp("myval") & "
"
>
> I would only see the first iteration of rstemp("myval"). The second line
> would just have "my val2:" on it with nothing following it!
>
> Furthermore, I'm pretty sure rstemp("myval") is null after the first
> response.write...trying to run any string function on it returns an error.
>
> I even replaced the code above with
>
> response.write "my val: " & rstemp("myval") & rstemp("myval")
>
> and I only see one instance of the var...help? What would cause the
> recordset to lose it's persistence like that?
> --
Re: response buffer clearing ADO cache?
am 30.11.2007 18:21:51 von Pierre-Andre van Leeuwen
"David Wang" wrote in message
news:973be8e5-e942-4748-8c67-966fc87267dc@e6g2000prf.googleg roups.com...
> Is the issue really caused by response.write?
Thanks David...it's looking more like an ADO issue I think (see below)...
>
> If you assign rstemp("myval") to another variable and response.write
> that variable twice, does that variable become null?
No.
> If you assign rstemp("myval") to two different variables, does it
> become null?
Yes, if I run this code:
dim mymsg_body : mymsg_body = rstemp("msg_body")
dim mymsg_body2 : mymsg_body2 = rstemp("msg_body")
mymsg_body2 will be null
> Is this on 32bit or 64bit Windows and what is the bitness of the
> worker process running your ASP page.
This is the 32-bit edition of server 2003 web edition.
How can I tell what the "bitness" is of the worker process?
>
>
> //David
> http://w3-4u.blogspot.com
> http://blogs.msdn.com/David.Wang
> //
>
>
>
>
> On Nov 29, 10:22 am, "geek-y-guy" wrote:
>> Hi All: I have a bizarre problem I've never encountered before, and hope
>> this is the correct place to post it. I believe it's an IIS issue,
>> although
>> it could be an ADO issue...I hope someone can help me figure it out!
>>
>> I'm on IIS 6 on Server2003 web edition sp2.
>>
>> I have some VBScript code where I open an ADODB recordset, and then loop
>> through it and response.write back some values from the recordset. Very
>> simple, been doing it for a million years, and the exact code has been
>> running on several different servers for years without a problem.
>>
>> code looks something like:
>>
>> <%
>> sql = "SELECT * FROM mytable " &_
>> "WHERE myval = " & myval
>> set rstemp = conn.Execute (sql)
>> do while not rstemp.eof
>>
>> response.write "my val: " & rstemp("myval") & "
"
>>
>> rstemp.movenext
>> loop
>>
>> rstemp.close
>> %>
>>
>> And that would work normally. rstemp("myval") is a varchar field in the
>> database btw.
>>
>> What I discovered, however, was this response.write was clearing whatever
>> buffer the recordset value was being held in. For example, if I repeated
>> the
>> code, like:
>>
>> response.write "my val: " & rstemp("myval") & "
"
>> response.write "my val2: " & rstemp("myval") & "
"
>>
>> I would only see the first iteration of rstemp("myval"). The second line
>> would just have "my val2:" on it with nothing following it!
>>
>> Furthermore, I'm pretty sure rstemp("myval") is null after the first
>> response.write...trying to run any string function on it returns an
>> error.
>>
>> I even replaced the code above with
>>
>> response.write "my val: " & rstemp("myval") & rstemp("myval")
>>
>> and I only see one instance of the var...help? What would cause the
>> recordset to lose it's persistence like that?
>> --
>
Re: response buffer clearing ADO cache?
am 30.11.2007 18:43:52 von Trevor Benedict R
Do you have a On Error Resume Next anywhere in your code. If so comment it
and re-try the operation and let us know if you see an actual error message.
Secondly try to swap the first line of code that prints the column value
with the second line. See if the results are the same. I 'm suspecting a
typo. A typo with On Error Resume Next can do wonders.
Regards,
Trevor Benedict
MCSD
"geek-y-guy" wrote in message
news:OfwElRrMIHA.5160@TK2MSFTNGP05.phx.gbl...
> Hi All: I have a bizarre problem I've never encountered before, and hope
> this is the correct place to post it. I believe it's an IIS issue,
> although it could be an ADO issue...I hope someone can help me figure it
> out!
>
> I'm on IIS 6 on Server2003 web edition sp2.
>
> I have some VBScript code where I open an ADODB recordset, and then loop
> through it and response.write back some values from the recordset. Very
> simple, been doing it for a million years, and the exact code has been
> running on several different servers for years without a problem.
>
> code looks something like:
>
> <%
> sql = "SELECT * FROM mytable " &_
> "WHERE myval = " & myval
> set rstemp = conn.Execute (sql)
> do while not rstemp.eof
>
> response.write "my val: " & rstemp("myval") & "
"
>
> rstemp.movenext
> loop
>
> rstemp.close
> %>
>
> And that would work normally. rstemp("myval") is a varchar field in the
> database btw.
>
> What I discovered, however, was this response.write was clearing whatever
> buffer the recordset value was being held in. For example, if I repeated
> the code, like:
>
> response.write "my val: " & rstemp("myval") & "
"
> response.write "my val2: " & rstemp("myval") & "
"
>
> I would only see the first iteration of rstemp("myval"). The second line
> would just have "my val2:" on it with nothing following it!
>
> Furthermore, I'm pretty sure rstemp("myval") is null after the first
> response.write...trying to run any string function on it returns an error.
>
> I even replaced the code above with
>
> response.write "my val: " & rstemp("myval") & rstemp("myval")
>
> and I only see one instance of the var...help? What would cause the
> recordset to lose it's persistence like that?
> --
>
>
>
Re: response buffer clearing ADO cache?
am 03.12.2007 16:27:02 von Pierre-Andre van Leeuwen
"Trevor Benedict" wrote in message
news:%23ZbWdk3MIHA.4948@TK2MSFTNGP02.phx.gbl...
> Do you have a On Error Resume Next anywhere in your code. If so comment it
> and re-try the operation and let us know if you see an actual error
> message.
No, no OERN
> Secondly try to swap the first line of code that prints the column value
> with the second line. See if the results are the same. I 'm suspecting a
> typo. A typo with On Error Resume Next can do wonders.
No, swapping does nothing...the first instance of rstemp("myval") seems to
clear the RS.
FWIW, I tried using "rs(9)" instead of the field name, but that makes no
difference either.
Also, I am running MDAC 2.82.3959.0 if that's any help...
DAMN! I discovered the problem. I was debugging some connection string
problems awhile back, and I revered to an ODBC connection string instead of
using SQLOLEDB.1...I just reverted to the OLE connection string, and lo and
behold it's working now...thanks everyone for their patience!
> Regards,
>
> Trevor Benedict
> MCSD
>
> "geek-y-guy" wrote in message
> news:OfwElRrMIHA.5160@TK2MSFTNGP05.phx.gbl...
>> Hi All: I have a bizarre problem I've never encountered before, and hope
>> this is the correct place to post it. I believe it's an IIS issue,
>> although it could be an ADO issue...I hope someone can help me figure it
>> out!
>>
>> I'm on IIS 6 on Server2003 web edition sp2.
>>
>> I have some VBScript code where I open an ADODB recordset, and then loop
>> through it and response.write back some values from the recordset. Very
>> simple, been doing it for a million years, and the exact code has been
>> running on several different servers for years without a problem.
>>
>> code looks something like:
>>
>> <%
>> sql = "SELECT * FROM mytable " &_
>> "WHERE myval = " & myval
>> set rstemp = conn.Execute (sql)
>> do while not rstemp.eof
>>
>> response.write "my val: " & rstemp("myval") & "
"
>>
>> rstemp.movenext
>> loop
>>
>> rstemp.close
>> %>
>>
>> And that would work normally. rstemp("myval") is a varchar field in the
>> database btw.
>>
>> What I discovered, however, was this response.write was clearing whatever
>> buffer the recordset value was being held in. For example, if I repeated
>> the code, like:
>>
>> response.write "my val: " & rstemp("myval") & "
"
>> response.write "my val2: " & rstemp("myval") & "
"
>>
>> I would only see the first iteration of rstemp("myval"). The second line
>> would just have "my val2:" on it with nothing following it!
>>
>> Furthermore, I'm pretty sure rstemp("myval") is null after the first
>> response.write...trying to run any string function on it returns an
>> error.
>>
>> I even replaced the code above with
>>
>> response.write "my val: " & rstemp("myval") & rstemp("myval")
>>
>> and I only see one instance of the var...help? What would cause the
>> recordset to lose it's persistence like that?
>> --
>>
>>
>>
>
>