Click to See Complete Forum and Search --> : Issuing Delte command on an Access Database
wan2fly99
03-23-2005, 08:01 AM
I have an asp page which runs an sql delete command to delete
a record from an access database.
Now I have tried to delete records that are not on the database.
I check the ERR.Number to see if it is not zero and also the ERR.Description to seeif not blank.
I cannot seem to get a not found condition. That is record being deleted is not there.
Thanks
buntine
03-23-2005, 08:28 AM
For clarification, are you doing something like this:
DELETE FROM tableName WHERE id = 10;
when there is no record with the id of 10?
If so, an error will not be generated within the ASP environment. I am not exactly sure if there is any way to check how many rows have been modified in ASP/ADO when the SQL statement does not return any rows. Mayby you could take a look at the RowCount and RecordCount properties in the RecordSet object.
Regards.
wan2fly99
03-23-2005, 09:12 AM
That is exactly whay I am doing. When I try to add a duplicate,
an error is returned.
Will try cehcking the recodcount on the recordset then
Thanks
buntine
03-23-2005, 07:54 PM
Ok. Well, generally, its not such a bad thing. It should not really happen as your GUI should prevent the user from being able to delete non-existant records.
Regards.
russell
03-23-2005, 11:56 PM
am pretty sure that the number of records affected by a delete statement is not returned to ado by msaccess.
also worth noting -- if primary/foreign key violations occur when attempting inserts, msaccess does not return an error -- it just refuses to do the insert quietly