Forums

This topic is locked

Is there a way to update a record?

Posted 22 years ago
1
has voted
22 years ago James Lee posted:
Hello there,

I have a problem updating certain records in my database. My idea is that if a person checks a checkbox stating to discontinue a product, the discontinue image would appear. The image's height is 45 pixels. So I have a field inside my database which is called Imageheight. If I want to make the image 'disppaear', I would have to make the height as 1 cos I cannot asiign it as 0. So this is my code here.

<% if ((rsProducts.Fields.Item("Discontinued".Value) = -1) then %>

' that means I have checked it

<% (rsProducts.Fields.Item("Imageheight".Value) = 45 %>

<%else%>

<% (rsProducts.Fields.Item("Imageheight".Value) = 1 %>

<% end if %>

But the final result is that my Imageheight field in my database is overwritten or empty!!

Care to explain why??

Replies

Replied 22 years ago
22 years ago Jeff DeHaven replied:
This may not be what you are looking for, but as an alternate method here is an idea:

use the yes/no field (checkbox) in your database, to determine whether or not to show the image. This can be done by creating a show or hide server behavior that will show or hide a particular item of dynamic content you specify based on the property of a given recordset.

The advantage of this is that you never loose the image size, you simply have the existing field that determines whether or not to show the image.
Or something to that effect...
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hello there,

I have a problem updating certain records in my database. My idea is that if a person checks a checkbox stating to discontinue a product, the discontinue image would appear. The image's height is 45 pixels. So I have a field inside my database which is called Imageheight. If I want to make the image 'disppaear', I would have to make the height as 1 cos I cannot asiign it as 0. So this is my code here.

&lt;% if ((rsProducts.Fields.Item("Discontinued".Value) = -1) then %&gt;

' that means I have checked it

&lt;% (rsProducts.Fields.Item("Imageheight".Value) = 45 %&gt;

&lt;%else%&gt;

&lt;% (rsProducts.Fields.Item("Imageheight".Value) = 1 %&gt;

&lt;% end if %&gt;

But the final result is that my Imageheight field in my database is overwritten or empty!!

Care to explain why??
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Edited by - jdehaven on 24 Dec 2002 23:13:40

Reply to this topic