Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tableupdate problem?
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Tableupdate problem?
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01555826
Message ID:
01555826
Views:
113
Hi everybody,

I seem to have a very strange problem and don't see where it's coming from. I have a very complex form with multi-pages pageframe on the right and a TList TreeView ActiveX on the left.

On the Template Edit page I have a button called Duplicate Template. This button calls a stored procedure to actually create a duplicate of the template and all related tables information. Once this finishes, I have this code:
parameters tnTemplateID, tnVenueID
private newTemplateID
newTemplateID = 0
if messagebox('Are you sure you want to duplicate the existing template and all the related information?',36,'Duplicate Template') = 6
   if mySQLExec ('execute dbo.siriussp_rsDuplicateTemplate ?m.tnTemplateID, ?m.tnVenueID, ?@newTemplateID', 'NewTemplateInfo', program())
      insert into rsTemplates select * from NewTemplateInfo
      =TABLEUPDATE(.t.,.f.,'rsTemplates')
      insert into rsLevels select * from NewTemplateInfo1 && Levels info
       =TABLEUPDATE(.t.,.f.,'rsLevels')
      thisform.lTemplateDuplicated = .t.
      
      if seek(m.newTemplateID, 'rsTemplates','TemplateID')

         thisform.AddTemplate(thisform.LastSelectedIndex) && this only sets up the Tree, it is not inserting any data
      endif
      wait window nowait 'Template was duplicated!'
    
      SELECT rsTemplates
	   =SEEK(m.newTemplateId, 'rsTemplates','TemplateID')
   else
      =messagebox('There was a problem duplicating the template...',48, 'Error with Duplicate Template')
      thisform.lTemplateDuplicated = .f.
   endif
endif

RETURN m.newTemplateId
The name I use to duplicate is the original name + ' - Duplicate'. So, after I duplicated I only leave Save button enabled. I change the description and press the Save button. At that point the new phantom record is created in addition to correctly updating the newly duplicated record with the
Original Name - Duplicate' description. It is only inserted into the template table, so I am able to delete that bad record afterwards.

However, I can not figure out why it's created at all? The rsTemplate table (which is buffered 5) doesn't have this record prior to delete. Unless (I'm going to verify it now) that record is deleted.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform