Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Nathan Gloyn
  Where is Nathan Gloyn?
 Torquay
 United Kingdom
 Nathan Gloyn
 Tags
Subject: Multiple SQL Statemetns
Thread ID: 33992 Message ID: 33992 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Databases, Tables and SQL Server
Date: Friday, December 05, 2003 6:39:41 PM         
   


I'm still trying to get to grips with VFP and use of cursors, tables etc.

I currently have this set of SQL statements I want to execute but keep getting file is in use errors. The application is only in use with me and the only tables that should be in use are the ones specified below as I want to run each statemtent.

I'm sure there must be a better way of doing this but at the moment my knowledge only gets me this far.

BEGIN TRANSACTION

* Remove link
IF !USED("linkpeopleidea")
	use linkpeopleidea shared in 0 
ENDIF

DELETE FROM linkpeopleidea ;
WHERE	ideakey = lnideakey ;
AND		peoplekey = nPersonKey

PACK

USE IN linkpeopleidea

IF !USED ("present")
	USE present shared in 0
ENDIF

* Add gift record
INSERT INTO present (presentkey, present) ;
VALUES	(lnPresentKey, lcPresent)

USE IN present

* add gift link
IF !USED ("linkpeoplepresent")
	use linkpeoplepresent shared in 0
ENDIF

INSERT	INTO linkpeoplepresent (presentkey, peoplekey) ;
VALUES	(lnPresentKey, nPersonKey)

USE IN  linkpeoplepresent

* Delete idea record
IF !USED("idea")
	USE idea shared in 0
ENDIF

DELETE FROM idea ;
WHERE	ideakey = lnideakey

PACK

USE IN idea

END TRANSACTION

* update the counter table
updatekey("present")



Any help would be apprieciated.

Nathan

ENTIRE THREAD

Multiple SQL Statemetns Posted by Nathan Gloyn @ 12/5/2003 6:39:41 PM
RE: Multiple SQL Statemetns Posted by Eric den Doop @ 12/5/2003 7:53:41 PM
RE: Multiple SQL Statements Posted by Nathan Gloyn @ 12/5/2003 11:08:17 PM
RE: Multiple SQL Statements Posted by Eric den Doop @ 12/6/2003 2:03:36 AM
RE: Multiple SQL Statements Posted by Nathan Gloyn @ 12/7/2003 9:58:05 PM