473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Simple unusual variable problem

Hi guru guys,

I have serious problem. At first sight it looks very simple but i dont
have any idea how to solve it.

With this statement 'If len(rs_cit) = 0 then rs_cit = 0' I cant put
into variable 'rs_cit' value '0' if it is clean. There is no value in
html displayed.

Here is code:

....
Dim rs_customer, rs_cit, rs_total, rs_manual

i = 1
Do While Not RS.Eof

rs_customer = RS("customer")
rs_account = RS("account")
rs_cit = RS("cit")
rs_total = RS("total")
rs_manual = rs_total - rs_cit

If len(rs_cit) = 0 then rs_cit = 0
'neither this does not work: If rs_cit = "" then rs_cit = 0
response.write ("<tr>")
response.write ("<td bgcolor='black' align='right'>" & i & ".</td>")
i = i + 1
response.write ("<td bgcolor='black'>" & rs_account & "</td>")
response.write ("<td bgcolor='black'>" & rs_customer & "</td>")
response.write ("<td align='center' bgcolor='#666666'>" & rs_cit &
"</td>")
response.write ("<td align='center' bgcolor='#666666'>" & rs_manual &
"</td>")
response.write ("<td align='center' bgcolor='#666666'>" & rs_total &
"</td>")
response.write ("</tr>")
RS.MoveNext
Loop
....
Jul 19 '05 #1
2 1131
rs_cit = RS("cit") might be null. In some cases using Len can be
unreliable.

Try

If IsNull(rs_cit) Or Len(rs_cit) = 0 Then rs_cit = 0
"Bramo" <ae****@pobox.sk> wrote in message
news:e3**************************@posting.google.c om...
Hi guru guys,

I have serious problem. At first sight it looks very simple but i dont
have any idea how to solve it.

With this statement 'If len(rs_cit) = 0 then rs_cit = 0' I cant put
into variable 'rs_cit' value '0' if it is clean. There is no value in
html displayed.

Here is code:

...
Dim rs_customer, rs_cit, rs_total, rs_manual

i = 1
Do While Not RS.Eof

rs_customer = RS("customer")
rs_account = RS("account")
rs_cit = RS("cit")
rs_total = RS("total")
rs_manual = rs_total - rs_cit

If len(rs_cit) = 0 then rs_cit = 0
'neither this does not work: If rs_cit = "" then rs_cit = 0
response.write ("<tr>")
response.write ("<td bgcolor='black' align='right'>" & i & ".</td>")
i = i + 1
response.write ("<td bgcolor='black'>" & rs_account & "</td>")
response.write ("<td bgcolor='black'>" & rs_customer & "</td>")
response.write ("<td align='center' bgcolor='#666666'>" & rs_cit &
"</td>")
response.write ("<td align='center' bgcolor='#666666'>" & rs_manual &
"</td>")
response.write ("<td align='center' bgcolor='#666666'>" & rs_total &
"</td>")
response.write ("</tr>")
RS.MoveNext
Loop
...

Jul 19 '05 #2
Bramo wrote:
With this statement 'If len(rs_cit) = 0 then rs_cit = 0' I cant put
into variable 'rs_cit' value '0' if it is clean. There is no value in
html displayed.
...
rs_cit = RS("cit")
...
If len(rs_cit) = 0 then rs_cit = 0
'neither this does not work: If rs_cit = "" then rs_cit = 0


For what it's worth, this is all you need to meet your needs in JScript:

rs_cit = RS.Fields("cit").Value || 0
It is sufficient because JScript coerces null and empty string values into
false boolean values when used in conditional assignment constructions.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ken Tuck | last post by:
Hi The following functions are working propery for IE, Ns 4.x and NS 6+ but the image I want to display disappears in IE. Why? function swapPic(layer,imgName,imgObj) { o = (n &&...
1
by: Jacob Arthur | last post by:
We are using Forms authentication in a webapp (ASP.net 1.1 VB, IIS6 on W2003) we created to maintain information on the currently logged-in user and their capabilities. After logging in, the user...
6
by: Armel Asselin | last post by:
Hello, I'm searching for a simple command line tool to manipulate XML files. The idea would be commands such as that: xmanip-tool set /document/xpath/@name="value" remove //wrong-nodes add...
10
by: Sourcerer | last post by:
I wrote this very simple code in .NET VC++. I compiled it on my system, and tried to run it on my friend's computer (he doesn't have the compiler). We both have Windows XP Professional. I have .NET...
0
by: Rasika WIJAYARATNE | last post by:
Hello everyone, We have a forum system on our website. The main web application is running in a virutal directory called /t7 and the forum system is on / t7/forums/. When someone wants to post...
10
by: sheldonlg | last post by:
I got an unusual request. One customer wants a password/access made available to a user that is valid for only, say, ten minutes. I know that I can enforce this by having a revalidation of the...
0
by: mk | last post by:
http://linux.byexamples.com/archives/365/python-convey-the-exception-traceba That's seriously weird. What's your Python version and platform? On my Windows and Linux machines, with more recent...
0
by: Robert Rawlins | last post by:
That's seriously weird. What's your Python version and platform? On my Thanks for that MK. I'm using Debian with Python 2.5 from the stable apt repository, installed but a couple of days ago....
2
by: astrogirl77 | last post by:
Hi, I'm new to Python and am hoping to find help with coding a Python script, applet. I code in an old version of Visual Basic 4.0, I have a simple app that is about 3 and a half pages of code...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.