Don't Show Blank Records...

Hello,
I have some recordsets on various pages which pull of data of some tables. Since I have a primary key for deletion purposes, this creates some blank fields under some tables with no data, only a key for the one with the data. Is there a way to skip any blank fields in a recordset and simply not display them? I know there is EOF but thats only if there are no records totally.

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

You may either filter out the nulls as hinted above through an SQL Query (Recommended) like:

select * from mytable where mycheckfield <> "" and mycheckfield is Not Null

OR

you may have a filter in your ASP Code so that when you display items, you can skip the null rows processing as :
----------------
while not rs.eof
If Not IsNull(rs("mycheckfield")) Then
Response.write rs("mycheckfield")
End If
rs.movenext
Wend
rs.close
----------------

The above one is recommended, since it will put less network traffic, and null rows will not even be returned from your database to you ASP Engine.

hello,
OK I tried the code above and ASP says that the field is either EOF or BOF and/or the record has been deleted. The code itself does supress EOF erros but with the addition of that code it doesnt. I then again tried the
Select From Test Where Test_5 <> "" and Test_5 is Not Null
BUT I get an HTTP 500 error that says that there was an Internal Error and I get no error messages from ASP.

First thing, The query should be like:
rsHW.Source = "SELECT * FROM Test Where P2 <> '' and P2 is Not Null"
Please note that you need to pass on 2 single quotes (apostrophes) to sql, instead of quotes!
(this will correct the 500 Error)

Another logical problem in your script:

The following loop is given multiple times in your code. Why? This is wrong as once you have looped through your recordset in a [while not rs.eof], it will never come into the second loop, as the rs.eof has already been reached.

While ((Repeat1__numRows <> 0) AND (NOT rsHW.EOF))

There is some definite logical problem in your code. Let me know in detail what you are doing here so that i can help you correct it.

Thanks for responding. Here is what I am trying to do with this page. This page is a page to delete records from a page via checkboxes. There are 3 columns in each table P2, P4, & P6 in the table Test. I have a table which gets the ID and the value of the the field and then displays it (hence I did not want blank records to show). I also want P4 and P6 on the same page so that is why it is repeated.

Hello,
Thanks for responding once again. At first the delete button didnt do anything. This was because the delete page did not have the original URL values that need to be passed: checkbox=... anyway so I added those in then I now get this error:
ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

then on del2.asp the following form data is submitted as : checkbox=1,3,4

If you specified form method=GET, then this form data will be automatically sent by the browser to the url del2.asp as: del2.asp?checkbox=1,3,4
[This data can be collected at del2.asp script as 'SelectedBoxes = request.querystring("checkbox")' which will have the value as 1,3,4 . You need
to split these comma seperated values to an array in your del2.asp, to get individual selected checkbox values.]

If you specified form method=POST, then this form data will be automatically sent by the browser to the url del2.asp as: checkbox=1,3,4 as submitted headers.
[This data can be collected at del2.asp script as 'SelectedBoxes = request.Form("checkbox")' which will have the value as 1,3,4 . You need
to split these comma seperated values to an array in your del2.asp, to get individual selected checkbox values.]

So you SHOULD not set the <del2.asp?checkbox=....> manually. Just specify the action of the form, and the browser automatically appends the selected checkboxes values with the URL.

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:
The Exchange of informatio…

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…

We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data.
But that feeling is fleeting. Attacks these days can happen in many w…