Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

Dreamweaver Sample Data

Posted 30 Nov 2004 19:32:21
1
has voted
30 Nov 2004 19:32:21 Jon Wendzina posted:
Why must I have sample data in my query? I have a form where a user can enter a name of something, and it does a search to find any results within a field of a table. However the auto-query function requires sample data, so I enter 1. In practise this is normally okay, but it can cause 2 potential problems.

1. If no data is entered and they submit the form, anything with a "1" will be displayed.
2. If they enter something where multiple records have to be accessed, the first page of 10 records are fine, when they click for the next page, the page contains nothing related to the query, but the second page as if the user entered a "1". Probably to do with the sample data.

How do I fix this?

Jon

Replies

Replied 30 Nov 2004 20:56:14
30 Nov 2004 20:56:14 Simon Martin replied:
By sample data do you mean default values?
If so the default values are there to prevent nasty errors being returned from your database if the search criteria was empty. However I would generally enter a value that was never going to return any records ever and on the results page stick in a 'Show Region if recordset empty' with some helpful text such as "Your search returned no results" Wrap your results up in a 'Show Region if recordset not empty' server behaviour. Doing something like this is quite robust and so your users are unlikely to get confronted with confusing error pages.

That will probably also fix the 2nd point you raise, assuming you're using the recordset navigation behaviour.

Live the life you love
Love the life you live

Simon

[DWMX 2004]|[SQL]|[ASP/VBScript]|[XP-Pro]
Replied 15 Dec 2004 15:40:47
15 Dec 2004 15:40:47 Jon Wendzina replied:
Okay well I've tried that. Problem is it fixes issue 1 but not 2. Now if I press to go to the next page of data, it says it's empty! Obviously because page 2 onwards reverts to the sample data, how come?

Jon

Reply to this topic