Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editable Grid working, but Edit link doesn't 1

Status
Not open for further replies.

david7777777777

Programmer
Sep 26, 2001
417
US
Merlin,
I modified my DATAGRID.ASP file and followed your directions for creating an editable grid..... very impressive. I also added the little "Edit" hyperlink into the grid with an unbound column =this.anchor('Edit'). But when I click the Edit hyperlink next to one of the other records listed in the grid I get a blank HTML page. I've looked at the code and can't figure out where I need to make a change. The trace returns this error after clicking on the Edit link in an attempt to bring another record up as the Current, editable row:
FILE: recordset.asp
FUNCTION: rsEditEmployees.moveAbsolute(nIndex)
DESCRIPTION: Err 414: Cannot move a closed or empty recordset.

Any hints? I'm sure I just missed a step or something. Thanks.
 
The error suggests that the recordset is closed.
The grid is based upon rsEditEmployees?
Do you explicitly close the recordset or change its SQL?
The trace should show the recordset being opened and initialised before the error - did this happen?
Perhaps if you attach the trace as a reply then I may be able to figure it out.
Note, the anchor method is slightly unusual in that it follows a slighlty different processing path to, for example, a button-click. The code that is executed is found at the bottom of the DATAGRID.ASP file.
Also note, the DATAGRID.ASP will absorb the RECORDSET events
(so you do not get a huge chain of onrecordexit onrecordenter events) so you may not see all of the possible TRACE event messages. (Content Management)
 
Merlin,

Yes, the grid is based on recordset rsEditEmployees.
I'm not knowingly closing the recordset. The SQL that I have in the rsEditEmployees is painfully simple:
SELECT *
FROM tbl_employees
WHERE LastName = ?


Then I set the parameter in the recordset for the ?, which is txtSearch.value. txtSearch is the name of the textbox where the user enters the last name of the employee to search for. Do I need some more SQL to keep the recordset alive?

You wrote "The trace should show the recordset being opened and initialised before the error - did this happen?"

I don't think so. Here's the play-by-play:
When the page initially loads, these are the traces:
EVENT TRACE: thisPage fired oninit event.
EVENT TRACE: thisPage fired onenter event.
EVENT TRACE: thisPage fired onshow event.
1. I enter a last name and click the btnSearch button.
2. For this last name, the grid displays 3 people, and these traces:
EVENT TRACE: thisPage fired oninit event.
EVENT TRACE: thisPage fired onenter event.
EVENT TRACE: btnSearch fired onclick event.
EVENT TRACE: rsEditEmployees fired onbeforeopen event.
EVENT TRACE: rsEditEmployees fired onrowenter event.
EVENT TRACE: rsEditEmployees fired ondatasetchanged event.
EVENT TRACE: rsEditEmployees fired ondatasetcomplete event.
EVENT TRACE: thisPage fired onshow event.
3. The first record in the list is editable.
4. The other two records have an Edit link beside them.
5. When I click the Edit link next to one of the other records, the trace shows multiple Warnings (one for each column I guess) each with the error 404 Attempt to access fields when recordset is at BOF or EOF. Here they are:
EVENT TRACE: thisPage fired oninit event.
EVENT TRACE: rsEditEmployees fired onbeforeopen event.
EVENT TRACE: rsEditEmployees fired onrowenter event.
EVENT TRACE: rsEditEmployees fired ondatasetchanged event.
EVENT TRACE: rsEditEmployees fired ondatasetcomplete event.
WARNING TRACE:
FILE: recordset.asp
FUNCTION: Fields.getValue(field)
DESCRIPTION: Err 404: Attempt to access fields when recordset is at BOF or EOF.

WARNING TRACE:
FILE: recordset.asp
FUNCTION: Fields.getValue(field)
DESCRIPTION: Err 404: Attempt to access fields when recordset is at BOF or EOF.

WARNING TRACE:
FILE: recordset.asp
FUNCTION: Fields.getValue(field)
DESCRIPTION: Err 404: Attempt to access fields when recordset is at BOF or EOF.

WARNING TRACE:
FILE: recordset.asp
FUNCTION: Fields.getValue(field)
DESCRIPTION: Err 404: Attempt to access fields when recordset is at BOF or EOF.

WARNING TRACE:
FILE: recordset.asp
FUNCTION: Fields.getValue(field)
DESCRIPTION: Err 404: Attempt to access fields when recordset is at BOF or EOF.

EVENT TRACE: thisPage fired onenter event.
WARNING TRACE:
FILE: recordset.asp
FUNCTION: rsEditEmployees.moveAbsolute(nIndex)
DESCRIPTION: Err 414: Cannot move a closed or empty recordset.

EVENT TRACE: thisPage fired onshow event.

EVENT TRACE: thisPage fired onexit event.

The End. Hope you can toss me a clue or two. Thanks greatly.
 
The textbox txtSearch - is this a DTC?

Do you apply the parameter in the pbSearch as

rsEditEmployees.setparameter 0, pbSearch.value
rsEditEmployees.open

i.e. the parameter should be set to a value rather than a reference to an object.

I presume that you have tried the editable grid on a test page that does not use parameters?
(Content Management)
 
No, I have not tried that. Yes, txtSearch is a DTC textbox that you use to enter the last name of the employee you are searching for. No I am not applying the parameter in the onclick event of the btnSearch button, but that part is working fine, right? Since it returns the records that match the last name that was entered into the txtSearch textbox, I would think that meant that the parameter is being successfully passed. It's the this.anchor('Edit') part that's not working correctly, right? Am I looking at this wrong?HEre's my btnSearch onclick event code:

Sub btnSearch_onclick()
rsEditEmployees.open
btnSearch.hide
txtSearch.hide
End Sub
 
try setting the parameter in the button click, rather than in the recordset properties dialog box:

Sub btnSearch_onclick()
rsEditEmployees.setparameter 0,txtSearch.value
rsEditEmployees.open
btnSearch.hide
txtSearch.hide
End Sub

Its the onlything I can think of. (Content Management)
 
That solved the problem. I cannot imagine what critical difference that makes, but it works. Cannot thank you enough for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top