Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Samir H.
  Where is Samir H.?
 Yogyakarta
 Indonesia
 Samir H.
 To: Jun Tangunan
  Where is Jun Tangunan?
 Cabanatuan
 Philippines
 Jun Tangunan
 Tags
Subject: RE: Allow user to delete?
Thread ID: 269040 Message ID: 269096 # Views: 47 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Friday, July 16, 2010 11:45:26 AM         
   


Thank you for the additional info.
I was aware of this problem with NULLs, that's why I started the thread. In a clipper POS app, I have de-normalized tables (I think that's how you call them?) where each transaction record holds the info it needs, which makes the files much bigger. And no relations. I want to remake it in VFP and change the whole system to a relational one.

> > Hello Jun
> > What does you code demonstrate, besides showing that Set Autoinc Off hides error messages?
> > I got the same results with autoinc ON and OFF. And correct results, it seems to me.
> > Can you explain a little bit more?
> >
> >
SET DELETED ON 
> > Set Autoincerror ON  
> > Create Cursor teacher (TPK I Autoinc, TName c(20))
> > Insert Into teacher (TName) Values ("Samir")
> > Insert Into teacher (TName) Values ("Jun")
> > 
> > Create Cursor students (SPK I Autoinc, SName c(20), TFK I)
> > Insert Into students  (SName,TFK ) Values ("Stud1",1)
> > Insert Into students  (SName,TFK ) Values ("Stud2",1)
> > Insert Into students  (SName,TFK ) Values ("Stud3",2)
> > 
> > 
> > Delete For TPK = 1 In teacher
> > SELECT teacher
> > BROWSE 
> > Select t1.SName, t2.TName From students t1;
> >     LEFT Outer Join teacher t2;
> >     ON t1.TFK == t2.TPK
> > ******************************************
> > SET DELETED ON 
> > Set Autoincerror OFF  
> > Create Cursor teacher (TPK I Autoinc, TName c(20))
> > Insert Into teacher Values (0,"Samir")
> > Insert Into teacher Values (0,"Jun")
> > 
> > Create Cursor students (SPK I Autoinc, SName c(20), TFK I)
> > Insert Into students Values (0,"Stud1",1)
> > Insert Into students Values (0,"Stud2",1)
> > Insert Into students Values (0,"Stud3",2)
> > 
> > 
> > Delete For TPK = 1 In teacher
> > SELECT teacher
> > BROWSE 
> > Select t1.SName, t2.TName From students t1;
> >     LEFT Outer Join teacher t2;
> >     ON t1.TFK == t2.TPK
> > 

> >
>
> >
> > Regards
> > Samir
>
>
> It is not about AUTOINCERROR setting, I simply do that because I don't want to have longer codes here. :-P
>
> What I am trying to say, which I guess is not that obvious; is if you delete a record on a master table, there will be orphan entries on child tables and that is not good.
>
> If you delete a record in master table (teacher in this case) then after a long time suddenly someone wants to trace who is the teacher of Stud1 & 2, they won't be able to find who as the link will be broken, you will simply have NULL values. That goes to other projects as well like in a POS. You don't simply delete a product when it already have transactions because if you do, you will have lots of NULLs later which will render whatever you want to extract somewhat half useful only.
>
> You can delete records on child tables though, or on master tables when again, no transaction has been made yet that will link to that record. On other cases, keep those records for audit trails (history) and just create a field to render those inactive or somewhat like that.
>
>
>
> http://www.junblogs.com/
> http://weblogs.foxite.com/sandstorm36/default.aspx
> http://www.coderisland.com/forum/viewforum.php?f=10



Regards
Samir

ENTIRE THREAD

Allow user to delete? Posted by Samir H. @ 7/16/2010 8:15:15 AM
RE: Allow user to delete? Posted by Eric den Doop @ 7/16/2010 8:44:09 AM
RE: Allow user to delete? Posted by Samir H. @ 7/16/2010 9:02:51 AM
RE: Allow user to delete? Posted by tushar @ 7/16/2010 9:07:21 AM
RE: Allow user to delete? Posted by Samir H. @ 7/16/2010 9:09:56 AM
RE: Allow user to delete? Posted by Mike Yearwood @ 7/16/2010 3:31:14 PM
RE: Allow user to delete? Posted by Samir H. @ 7/16/2010 3:40:28 PM
RE: Allow user to delete? Posted by Mike Yearwood @ 7/16/2010 7:08:49 PM
RE: Allow user to delete? Posted by Samir H. @ 7/16/2010 7:23:49 PM
RE: Allow user to delete? Posted by Samir H. @ 7/28/2010 7:50:51 PM
RE: Allow user to delete? Posted by Mike Yearwood @ 7/28/2010 8:45:57 PM
RE: Allow user to delete? Posted by tushar @ 7/29/2010 6:09:49 AM
RE: Allow user to delete? Posted by Samir H. @ 7/29/2010 6:16:56 AM
RE: Allow user to delete? Posted by Mike Yearwood @ 7/29/2010 6:37:48 AM
RE: Allow user to delete? Posted by Samir H. @ 7/29/2010 6:44:02 AM
RE: Allow user to delete? Posted by Mike Yearwood @ 7/29/2010 6:47:55 AM
RE: Allow user to delete? Posted by Samir H. @ 7/29/2010 6:51:16 AM
RE: Allow user to delete? Posted by Mike Yearwood @ 7/29/2010 6:53:54 AM
RE: Allow user to delete? Posted by Samir H. @ 7/29/2010 7:11:42 AM
RE: Allow user to delete? Posted by Jun Tangunan @ 7/16/2010 9:24:37 AM
RE: Allow user to delete? Posted by Samir H. @ 7/16/2010 11:07:02 AM
RE: Allow user to delete? Posted by Jun Tangunan @ 7/16/2010 11:36:30 AM
RE: Allow user to delete? Posted by Samir H. @ 7/16/2010 11:45:26 AM
RE: Allow user to delete? Posted by Jun Tangunan @ 7/16/2010 11:57:03 AM
RE: Allow user to delete? Posted by Samir H. @ 7/16/2010 12:06:24 PM
RE: Allow user to delete? Posted by Mike Yearwood @ 7/17/2010 12:06:21 AM
RE: Allow user to delete? Posted by Samir H. @ 7/17/2010 5:41:37 AM
RE: Allow user to delete? Posted by Mike Yearwood @ 7/16/2010 3:24:20 PM
RE: Allow user to delete? Posted by Samir H. @ 7/16/2010 3:35:58 PM
RE: Allow user to delete? Posted by Mike Yearwood @ 7/16/2010 6:58:12 PM
RE: Allow user to delete? Posted by Samir H. @ 7/16/2010 3:44:11 PM
RE: Allow user to delete? Posted by Mike Yearwood @ 7/16/2010 11:13:37 PM
RE: Allow user to delete? Posted by Binod Binani @ 7/17/2010 7:51:53 AM
RE: Allow user to delete? Posted by Samir H. @ 7/21/2010 6:17:52 AM
RE: Allow user to delete? Posted by Mike Yearwood @ 7/21/2010 3:30:07 PM
RE: Allow user to delete? Posted by Samir H. @ 7/21/2010 4:14:28 PM
RE: Allow user to delete? Posted by Samir H. @ 8/2/2010 7:38:23 AM
RE: Allow user to delete? Posted by Mike Yearwood @ 8/2/2010 3:42:57 PM
RE: Allow user to delete? Posted by Samir H. @ 8/2/2010 3:58:20 PM
RE: Allow user to delete? Posted by Mike Yearwood @ 8/2/2010 4:00:51 PM
RE: Allow user to delete? Posted by Samir H. @ 8/2/2010 4:10:57 PM
RE: Allow user to delete? Posted by Mike Yearwood @ 8/2/2010 4:27:01 PM
RE: Allow user to delete? Posted by Samir H. @ 8/2/2010 5:45:12 PM
RE: Allow user to delete? Posted by Mike Yearwood @ 8/2/2010 8:00:48 PM