ADOCE Delete question * 3 
Author Message
 ADOCE Delete question * 3

The example in the WinCE MSDN help shows this
I added my question to the apropriate location
Dim rs
Set rs = CreateObject("ADOCE.Recordset.3.0")
rs.Open "myTable", "", adOpenKeyset, adLockOptimistic
rs.MoveLast
'This statement deletes the current (last) record.
rs.Delete
'This statement moves the pointer to the
'first record in the recordset, which removes
'the deleted record from the recordset.
rs.MoveFirst   <<<<<<<<<<<<<<<<<<My question is about this line>>>>>>>>>>
rs.Update
rs.Close
Set rs = Nothing

Could you explain the effects of running this code on a recordset with only
one record?
my first question: in a recordset with only 1 record wont this result in an
error?
Secondly, I have added a check before the movefirst to make sure the BOF is
false.
Will the record still be removed without the movefirst if it is the only
record in the table?
Lastly, in my code I am not closing the recordset after the deletion.  (Is
this bad form?)



Mon, 19 Apr 2004 01:15:43 GMT  
 ADOCE Delete question * 3
Tom,

I have not tried this code, but the record is not fully deleted until you
issue the rs.update line.  Moving to the first record in a recordset with
only one record would take you to that same record.

If you do not need the recordset it is a good idea to close the connection.

--
Sincerely,

Sean M. Severson
Project Manager

===============================
"Our aim is to become partners in your
success through our performance."

Technical Assistance Company
807 Forest Avenue
Sheboygan Falls, WI  53085

(920) 467-6711
www.2tacweb.com
===============================

Quote:
> The example in the WinCE MSDN help shows this
> I added my question to the apropriate location
> Dim rs
> Set rs = CreateObject("ADOCE.Recordset.3.0")
> rs.Open "myTable", "", adOpenKeyset, adLockOptimistic
> rs.MoveLast
> 'This statement deletes the current (last) record.
> rs.Delete
> 'This statement moves the pointer to the
> 'first record in the recordset, which removes
> 'the deleted record from the recordset.
> rs.MoveFirst   <<<<<<<<<<<<<<<<<<My question is about this line>>>>>>>>>>
> rs.Update
> rs.Close
> Set rs = Nothing

> Could you explain the effects of running this code on a recordset with
only
> one record?
> my first question: in a recordset with only 1 record wont this result in
an
> error?
> Secondly, I have added a check before the movefirst to make sure the BOF
is
> false.
> Will the record still be removed without the movefirst if it is the only
> record in the table?
> Lastly, in my code I am not closing the recordset after the deletion.  (Is
> this bad form?)



Mon, 19 Apr 2004 06:02:28 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ADOCE 3.0 - delete from tablename

2. How do I delete tables with ADOCE?? (nt)

3. Several ADOCE question (Need reference)

4. SQL delete query deletes but does not delete

5. Update ADOCE 3.0 to ADOCE 3.1 in eVB - how?

6. Deleting tables question 2

7. DELETE sql syntax question

8. Tabledef.delete question

9. question about using file.delete

10. Deleting DataSet rows -- a question

11. Delete Method Question

12. Question: Deleting Multiple Items in ListBox??

 

 
Powered by phpBB® Forum Software