Forums

This topic is locked

<% If Recordset1.Fields.Item("text_intro").Value =

Posted 07 Jul 2001 16:45:09
1
has voted
07 Jul 2001 16:45:09 suhail kaleem posted:
&lt;% If Recordset1.Fields.Item("text_intro".Value = Session("username" Then %&gt;
&lt;Img src = "images/no_photo.gif" width="85" height="100" align="middle" border="1" &gt;
&lt;% else %&gt;
&lt;img src="&lt;%=(Recordset1.Fields.Item("text_intro".Value)%&gt;" align="middle" width="200"&gt;

&lt;% End If %&gt;

Replies

Replied 08 Jul 2001 13:55:21
08 Jul 2001 13:55:21 Joel Martinez replied:
hmm, I think this post should be filed under "cryptic"

-what are you trying to accomplish with this code?
-are you getting an error message?
--if so, what is the error message?

Joel Martinez

----------
Is this thing on?....
Replied 08 Jul 2001 19:02:59
08 Jul 2001 19:02:59 suhail kaleem replied:
oh i am sorry . here are the details ..

iis 5 , ie 6 , asp ,win xp ,access xp

it gave me no error - feild name are corect evry thing is fine -

the above code always give me the no pic image - although the text_intro contains a value . THEN works But the &lt;% else %&gt; doest not work . if u want i will email u the whole script -

any help ?

Replied 08 Jul 2001 20:00:22
08 Jul 2001 20:00:22 Joel Martinez replied:
hmmm... ok, from what I can gather, the "text_intro" field of the recordset is the URL to the image that you want to display...
I see that the if statement is comparing this URL, to the session variable "username"

I"m not totally sure what your application is trying to accomplish, but you've got to know the runtime values of both the "username" and the "text_intro".
do this by doing a response.write before the comparison is made:

response.write "username: " & session("username"
response.write "text_intro: "& Recordset1.Fields.Item("text_intro".Value

once you know these values at runtime, you can know if the comparison is doing what you want it to do...
in reality, you're the only one that knows how you want you app to behave, so once you do a little debugging, you can make the right changes.

<b>Joel Martinez</b>

----------
Is this thing on?....
Replied 08 Jul 2001 20:21:47
08 Jul 2001 20:21:47 Waldo Smeets replied:
suhailkaleem,

I have the strong feeling that you are using an access database. I learnt from my Conditional Region extension that everyone using an acces database has these problems. You can grab the value of the database field only once and after that the values always seems to be empty.

A solution that always works:
&lt;% DIM myVar=Recordset1.Fields.Item("text_intro".Value %&gt;
&lt;% If myVar = Session("username" Then %&gt;
&lt;Img src = "images/no_photo.gif" width="85" height="100" align="middle" border="1" &gt;
&lt;% else %&gt;
&lt;img src="&lt;%=(myVar)%&gt;" align="middle" width="200"&gt;
&lt;% End If %&gt;

But remember: this is a workaround. I read somewhere that changing the recordset properties should solve the problem. Select the recordset in your databindings window and open the property inspector. There you can change the recordset properties.
I don't remember the correct settings to make it work but maybe you should do some trial and error experiments and report the results here.
We have a tutorial on the recordset properties that might help you: www.UDzone.com/go?710

Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------
Replied 09 Jul 2001 15:49:57
09 Jul 2001 15:49:57 suhail kaleem replied:
hey waldo !

&lt;% DIM myVar
&lt;% myVar=Recordset1.Fields.Item("text_intro".Value %&gt;
&lt;% If myVar = Session("username" Then %&gt;
&lt;Img src = "images/no_photo.gif" width="85" height="100" align="middle" border="1" &gt;
&lt;% else %&gt;
&lt;img src="&lt;%=(myVar)%&gt;" align="middle" width="200"&gt;
&lt;% End If %&gt;

the aboive code isnt working same problem then is not working but else is working .

i have a pagetaht out puts images froma text intro coloum - text_intro coloum have ten record recortd num 6 and 5 are empty ..now when i disply reord num 1 it shows me a image but when i try to show a record num 5 or 6 it does not show me the images it shows me a red cross i want it to show the no-pic.jpg but it does not do that . i am reeally stuck with this very very simple if then else . i cant get to work.

any help ?

suhailkaleem

Replied 09 Jul 2001 15:55:05
09 Jul 2001 15:55:05 Waldo Smeets replied:
You'd better first start debugging like Joel mentioned.

Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
------------------------------------------

Reply to this topic