Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 23rd, 2004, 11:14 AM
Authorized User
 
Join Date: Jun 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default checking fields value from rs

I have this rsCustomer executing on a page, and I want to find an easyway of checking if any of the fields are empty or Null. at the moment I am using If IsNull(rsCustomer("fieldname)) then but there must be a better way, cause I want to redirect them to update profile page.

any good ideeas?
 
Old July 23rd, 2004, 05:57 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

I am not sure I understand the problem. What does the IsNull have to do with a Redirect statement? What can't you redirect when the column IsNull (or isn't) and why do you need a better alternative for IsNull?

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 24th, 2004, 01:57 AM
Authorized User
 
Join Date: Jun 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the database has been on the server for more than 3 years.
the entire website is getting redone and more than 10 new fields has been added to the customer table.

if a customer comes back to the website, all the new fileds added have empty value, so i need to redirect them to the update details page. As I said I could do it by checking the field for null value, but i thought is a cleaner way of doing it, instead typing 20 lines of code.
 
Old July 24th, 2004, 02:03 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Well, I don't think so. You have to check out whether the field contains Null to find out whether it contains null ;)

Instead of 10 redirect statements, you could query the database for the null fields. Something like this:

SELECT Count(ID) FROM Customer WHERE Field1 = Null OR Field2= Null WHERE Customer.ID = 1234

If this query returns a record, some of the new fields was null so you need to redirect.

Does this help?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 24th, 2004, 02:23 AM
Authorized User
 
Join Date: Jun 2003
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No, that's not good, as i don't want to query the database again. all fields are already filter and written to the browser, so another call to the database is out of discussion.

i'll stick to my statement:

if IsNull(rsCustomer("LastName")) or IsNull(rsCustomer("FirstName")or...and so on... then
response.redirect("updatepage.asp")

Thanks anyway.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error checking for table fields null value constra method Access VBA 1 September 26th, 2005 09:00 PM
Assign fields to an ADO rs in C# yossarian ADO.NET 1 January 18th, 2005 01:12 PM
Using Forum fields select fields on the fly hellosureshkumar Crystal Reports 0 December 17th, 2004 08:20 AM
RS Manager and RS Server on 2 different computers Choose File BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 July 22nd, 2004 10:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.