Forums
This topic is locked
no recordset action
Posted 16 Apr 2003 13:04:31
1
has voted
16 Apr 2003 13:04:31 Richard Krawczak posted:
Hi there,I face a slight little problem. When submitting to a page by mistake, the page gives an error.
It can’t provide a record set because there is no recordset, and so the page gives an expected error . It does not bother me. But it will scare the shit out of my customers. So
I would like the user to be redirected when there is no record set instead of a nasty error page
But rs.EOF or and BOF give me no tool. They can only provide an action when there is a record set and not when there isn’t.
I need a piece of code that reacts to the fact that there is no expected record set and then redirects.
Hope I’m clear enough, sometimes coding makes you…well you know. So two examples to make you understand the situation.
“User loses password. Can provide an email and then submits, thus getting a username and password back by mail. But when the user forgets the input…
A user wants to delete certain measurements of a product but wants to delete where there are no records left. Oomph error”
Regards
JJF
Edited by - Jumping Jack Flash on 16 Apr 2003 13:12:21
Edited by - Jumping Jack Flash on 17 Apr 2003 19:59:52
Replies
Replied 17 Apr 2003 16:30:31
17 Apr 2003 16:30:31 Stefan P replied:
Hi JJF
I think I get what you're saying. If so here's a simple workaround.
If there's not results for the recordset then use a :Show If Recordset Is Not Empty behaviour and then a Show If Recordset Is Empty behaviour for the following:
Either put in appropriate text with a link to another page or instead of this you could try
<% If rsRecordset.BOF AND rsRecordset.BOF Then
response.redirect "anotherpage.asp"
End If %>
Stefan
DMX | ASP | VBScript | ACCESS | IIS5
I think I get what you're saying. If so here's a simple workaround.
If there's not results for the recordset then use a :Show If Recordset Is Not Empty behaviour and then a Show If Recordset Is Empty behaviour for the following:
Either put in appropriate text with a link to another page or instead of this you could try
<% If rsRecordset.BOF AND rsRecordset.BOF Then
response.redirect "anotherpage.asp"
End If %>
Stefan
DMX | ASP | VBScript | ACCESS | IIS5
Replied 17 Apr 2003 19:59:17
17 Apr 2003 19:59:17 Richard Krawczak replied:
Hi there sesame,
Yes i've tried what you suggest.
But it will only work when there is a recordset. In this case there is no recordset and an EOF or BOF won't work.
They only work if there is a recordset on which it can check beginning or end of file.
To make it more confusing, i try to tell you the realtime situation:
Marriage between two pages which direct to eachother.
The first one is an insertpage with an insertbehavior uploading a value to a table which contains several measurementvalues regarding a unique id of a product in the product-table. One product can have many measurementvalues
To insert is no problem given the product_id and the new variable of the measurement send.
Whowever deleting also uses the product_id parsing the variable by url to the next page, the delete page.
As long as there is a matching value to the measurementvalue everything goes wel. But if the last value is deleted and the customer again tries to go to the delete page then he/she gets an error telling there is no recordset. And indeed there isn't since the last record was deleted and there is no recordset left. The product_id is still alive in the product table since only the measurements of this product have been deleted
hope
JJF
Edited by - Jumping Jack Flash on 17 Apr 2003 20:04:38
Edited by - Jumping Jack Flash on 17 Apr 2003 20:19:15
Yes i've tried what you suggest.
But it will only work when there is a recordset. In this case there is no recordset and an EOF or BOF won't work.
They only work if there is a recordset on which it can check beginning or end of file.
To make it more confusing, i try to tell you the realtime situation:
Marriage between two pages which direct to eachother.
The first one is an insertpage with an insertbehavior uploading a value to a table which contains several measurementvalues regarding a unique id of a product in the product-table. One product can have many measurementvalues
To insert is no problem given the product_id and the new variable of the measurement send.
Whowever deleting also uses the product_id parsing the variable by url to the next page, the delete page.
As long as there is a matching value to the measurementvalue everything goes wel. But if the last value is deleted and the customer again tries to go to the delete page then he/she gets an error telling there is no recordset. And indeed there isn't since the last record was deleted and there is no recordset left. The product_id is still alive in the product table since only the measurements of this product have been deleted
hope
JJF
Edited by - Jumping Jack Flash on 17 Apr 2003 20:04:38
Edited by - Jumping Jack Flash on 17 Apr 2003 20:19:15