Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you make an updatable SQL table? 1

Status
Not open for further replies.

chpicker

Programmer
Joined
Apr 10, 2001
Messages
1,316
Rajrajcoomar replied to a post below in regard to an SQL statement saying that he would first make an updatable SQL table. How do you do this? I've been trying to figure it out for some time now. I have several places in my app where I want to pull selected records out of an existing table and put them in a grid for the user to select from. I need one or two fields from the original table and a TAGGED field that can be toggled by the user's actions. I would love to use an SQL query to fill the grid, but that always makes a read-only cursor, which is useless to me, so I end up with a page of code from CREATE CURSOR to the SCAN FOR..ENDSCAN block that fills it.

So, how do you make an updatable SQL table?
 
Hi
Select your DATA tab.. select the view you want to make updatable.. Click on modify..
NOw click on the tab.. UPDATE CRITERIA
Now clik just below the key picture and
then adjacent to all fields you want to update .. if you cant figure out.. click on UPDATE ALL button.. you will see the tick mark againt all fields.. now you can figure it out.. The wizard is guiding you all these what I said..
Hope this is helpful :-) ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
So, this isn't something you can create programmatically? It has to be made in the database? What I was hoping for was just a cursor, local to the session, that can have its data changed, but that is not persistent in the database. Is this possible? Or do I have to do this:
Code:
create cursor myCursor(field 1,field 2,field 3,...,tagged l)
select myTable
goto top
m.tagged = .F.
scan for (mycriteria)
	scatter memvar memo
	insert into myCursor from memvar
endscan
What I was hoping for was some kind of SQL statement that would pull the records I want, but would be LOCAL to the session and NOT persistent in the database.
 
Actually the easiest way to get a SQL 'selected' cursor updatetable is to use the new VFP 7.0 option:
... INTO CURSOR CursorName READWRITE ...

Before this, you "cheat" and access the temporary table that VFP uses IF you don't create a SELECT that VFP can create by simply filtering the original table.

Your example would work something like this:
Code:
SELECT a.field1,a.field2,a.field 3, ...,;
 .T. as tagged;
 FROM myTable a ;
 INTO CURSOR myCursor ;
 WHERE <mycriteria>
USE DBF('myCursor') alias pTable IN 0 AGAIN
SELECT pTable
BROWSE
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top