*Fixed* ASP Help

DJFuji

Diamond Member
Oct 18, 1999
3,643
1
76
Ok i have a problem. An ASP page submits to itself where the code at the top of the page deletes the selected record or adds a new one, depending on what button was pressed. Then, right after the change is made, a new recordset is opened and queries the same table. (to show the results in a drop down list) The problem is that the 2nd recordset acts as if it can't see the changes that were just made. (the adding or deleting). When the page is refreshed, the 2nd recordset suddenly 'sees' the changes and shows them.

My question is how can i make it so that the 2nd recordset sees the changes immediately?

I'm using:
"rsDeleteEmp.open Delete_SQL, GetConnection, adOpenDynamic, adLockOptimistic"

where:
rsDeleteEmp = recordset object
Delete_SQL = SQL statement
GetConnection = connection string

I've tried using adOpenKeyset as well as adLockPessimistic, but neither of them do anything different. I suspect that it might have something to do with the 1st recordset "locking" the records so when the 2nd is loaded, it can't see the changes made. When the page is refreshed, there are no changes made, so the 1st recordset "unfreezes" the records. Am i on the right track here?


edit: clarified

Edit: Ok i'm a dumbass. I forgot to close the recordsets that are adding/deleting the records. It was probably locking out the 2nd recordset from viewing the changes...
 

oog

Golden Member
Feb 14, 2002
1,721
0
0
Do you have any way to verify that the record has actually been deleted? Could it be that the delete isn't actually happening and so that's why you see the same results?
 

DJFuji

Diamond Member
Oct 18, 1999
3,643
1
76
no, the record is deleted. When i select another record from the DDL (it auto submits), it updates and the record is then shown as gone. Plus, the database shows that the deletion occurs immediately.
 

DJFuji

Diamond Member
Oct 18, 1999
3,643
1
76
i just added "add new" functionality and the same phenomenon happens-- as soon as i make the change the page refreshes, and i can't see it until i refresh once more.
 

oog

Golden Member
Feb 14, 2002
1,721
0
0
what kind of database is it? do you close and open the connection in between? you shouldn't have to, but maybe the write isn't committing until the connection closes. you may need to write your code slightly differently to get the changes to flush immediately.
 

DJFuji

Diamond Member
Oct 18, 1999
3,643
1
76
it's an access db. And yeah, i did a rs.close at the bottom of the page. The thing is, as soon as i hit "delete", the record disappears from the db. But it doesn't actually show on the interface until i refresh by posting back again. (usually through a new selection in the DDL)