473,503 Members | 13,285 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do find a empty field/value/records?

I know it should be very easy but I am new in ASP so I could not
figured out.
Here is the simplified version of my code:

thePaymentID= request.querystring("IDValue")

SQLqueryPayment= "SELECT sum(paid) as paid, sum(Interest) as interest
FROM payment WHERE payment_ID =" & thePaymentID & ""

dim rstempPayment
set conntemp=server.createobject("adodb.connection")
conntemp.Open "DSN=payment"

set rstempPayment=conntemp.execute(SQLqueryPayment)
fldValPaid = rstempOwner.Fields("paid").Value
------------------------------------------------------------------------
I need to find out if "fldValPaid" hold anything. I will use it an
IF ELSE statement. In payment table a particular record could exist or
not. How do I find out by evaluating "fldValPaid" if any record
exists or not. I have to find out using "fldValPaid" ...I can not
use number of record/record return or any other method.

I hope you understand my question.
Thanks,
-Rahman

Dec 19 '05 #1
1 1963
rahman wrote:
I know it should be very easy but I am new in ASP so I could not
figured out.
Here is the simplified version of my code:
In the future, please tell us what database type and version you are using.
It is almost always relevant.
thePaymentID= request.querystring("IDValue")

SQLqueryPayment= "SELECT sum(paid) as paid, sum(Interest) as interest
FROM payment WHERE payment_ID =" & thePaymentID & ""

dim rstempPayment
set conntemp=server.createobject("adodb.connection")
conntemp.Open "DSN=payment"
You may want to consider replacing your ODBC DSN with the native OLE DB
provider for your database:
http://www.aspfaq.com/show.asp?id=2126

set rstempPayment=conntemp.execute(SQLqueryPayment)
fldValPaid = rstempOwner.Fields("paid").Value
------------------------------------------------------------------------
I need to find out if "fldValPaid" hold anything. I will use it an
IF ELSE statement. In payment table a particular record could exist or
not. How do I find out by evaluating "fldValPaid" if any record
exists or not.


You can't. fldValPaid will always contain a value, whether any records
existed or not. What you need to do is add a third aggregate calculation to
your query to count the number of records:
.... as interest, count(*) as payments FROM ...

Then check the value of the payments field to see if it's greater than 0.

HTH,
Bob Barrows
PS. You may want to consider using parameters rather than dynamic sql. Your
application will be more secure, robust and easier to maintain:

http://groups-beta.google.com/group/...e36562fee7804e
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Dec 19 '05 #2

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

Similar topics

1
5011
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
3
8861
by: tornado | last post by:
Hi all, I am pretty new to PHP. I was reading PHP manual and trying out the example from 2nd chapter (A simple Tutorial). When i try to print the variable as given in the example it returns...
5
7083
by: Adrian Parker | last post by:
Hi. I have a date time picker in my program which uses ADO to read from an Access database. It works perfectly, unless the database is empty (no records) when opened. When you try to open an...
2
1715
by: ET | last post by:
Hi! I'll need help on what todo with this information in table... There has to be a unique on one column (Item ID, for inventory purpose) but in many cases that ID is not known... thus, many...
7
3430
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function...
3
14897
by: jmarr02s | last post by:
Hi, How do I replace with when the field is empty? Thanks! jmarr02s
7
4529
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
2
2338
by: hackmagic | last post by:
Hi, i have a form that normally has a Recordset containing only one record bound to it. i have replaced the navigation buttons with my own and the 'New Record' button assigns an empty Recordset...
1
6193
by: G04 | last post by:
Hi All, I have a continuous form with all records. For each field there is a combo in the form header and the form also contains a Toggle button "Apply Filter". When clicked, it changes to...
0
7098
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
7296
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
7364
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...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5604
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
405
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.