Shared databases in VB4 - DANGER! 
Author Message
 Shared databases in VB4 - DANGER!

Jesus Christ, do Microsoft do these things just to wind us up or what!?!?!

Anyway, to the point...

If I have an Access table with say 10 records and execute the following code in VB3 behind a
command button...

dim rs as table

set rs=db.opentable("tablename")
rs.movelast
msgbox rs.recordcount
rs.close

I do as expected get a count of 10! Yippee!
If I then add a record to the table using another program on my PC and click the button again
I get a count of 11! Yippee AGAIN!

Now try it in VB4?!?!?!?!?!?!?!!?!? (modifying 'table' for recordset).
The second time you click the button (wait for it...) you get a count of... 10? Aaaaaggghhh!
Why in God's name should a newly opened recordset NOT reflect the current contents of the
table?????????!!!!!!!

Even more dangerous than this... try deleting some of the records... you still get a recordcount
of 10 AND YOU CAN STILL READ THE CONTENTS OF THE DELETED RECORDS!!!!

Can anybody provide any justification for Microsoft implementing this behaviour? Or is it
complete incompetence on their part (don't they ever write multi-user apps?)?

As a workaround I notice the recordset object has a requery method. This cannot however be used
on a 'table' flavour recordset. Thus to ensure I get the correct current data I have to use...
set rs=db.openrecordset("tablename",dbopendynaset)
rs.requery
set rs=db.openrecordset("tablename") 'defaults to table recordset

I want to use table recordsets for speed but then have to add two garbage lines which weren't
required in VB3!

Does anybody have a better workaround?



Sun, 13 Dec 1998 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. CAUTION: Re: !Danger! Humor around !Danger!

2. !Danger! Humor around !Danger!

3. Great VB-type system in danger of being shelved

4. What Are The Dangers of not DIM ing VARS

5. Danger of using Kill?

6. Is there any danger in re-parenting ActiveX Server Forms

7. Reverse-Engineering DANGER?

8. Setup Wizard Danger?

9. Dictionary dangers?

10. VB is a Danger

11. VB is a Danger

12. VB4-16, SHARE.EXE and Windows 95B

 

 
Powered by phpBB® Forum Software