Im having problems refreshing a grid.i have placed a table in data enviroment.then i drag and dropped all of his items creating a grid.then in a button i have a
select...where..into this table.this way i put new values in the table,basically i overwrite the entire table.at that time grid becomes white,no values
i tried grid.refresh nothing
i tried to grid.recordsource=""
select where into...
grin.recordsource=mytable
still nothing
is there a way to make the grid to reload the table

GRID REFRESH
Eddie H
Fishy Pete
Hi cetinbasoz,well i tried to use a cursor,i create it with a select ,and i view it
in a grid with recordsource.
when i try to insert into mycursor
i get a cursor is read only error
cursorsetprop
doesnt has readonly,how do i fix this
the code so far is:
SELECT ar_ent,Logar.kodikos, Logar.perigrafi, Deytero.tit1, Deytero.tit2,;
thisform.allpages.page6.grdAnazitisitrantempatable.Recordsource="myCursor"Tran.ajia, Tran.hmer;
FROM tran ;
inner JOIN logar ;
ON Tran.kodikos = Logar.kodikos ;
inner JOIN deytero ;
ON Tran.deytero = Deytero.deytero ;
WHERE Tran.ar_ent ==temp ;
into cursor "myCursor"
thisform.allpages.page6.grdAnazitisitrantempatable.Refresh() cursorsetprop('Buffering',5,'myCursor')
its a select from 3 tables which i save it in a cursor and view it in a grid,user should then be able to add some values to this cursor ,or
delete -edit them
finnally all these values should be appended in the original tran table
pershing
.recordsource = "myCursor"
but:
.recordsource = 'select ... into myCursor readwrite'
Please read sections about views. You might find it easier (but I don't mean you to update 3 tables from a view-never update multiple tables from a view IMHO). With a view you define the SQL using designer or by code. Then it would be easier to do:
Requery('myView')
to refresh the contents. Still you would manually manage the updates to base tables (recommended but there are samples doing it to multiple tables at once if you prefer at your own risk).
pikachu123
You are thinking but not right. You can do all those with the cursor in the sample. Pity you even didn't try once.
With cursor you don't need tableupdate() part IMHO but if you want you can also make that cursor buffered:
cursorsetprop('Buffering',5,'myCursor')
insert into myCursor ...
delete from myCursor ...
etc commands are also available for a cursor.
I didn't exactly understand second part of your question. Append always do its job. If you provide codes more clearly we could see what might be going on.
moh081
the table will be accessed again and records might be deleted added etc.
for example :(not sql code)select all customers from france
i want the result to be in a table so that i can for example add another customer from france into that list.if i view in a cursor ->grid i wont be able to make changes right
nikki6969
before the update or set the source to 0
ex: thisform.grid1.RecordSourceType= 0
...
do anything with the table
...
thisform.grid1.RecordSourceType= 1
thisform.grid1.RecordSource="your table"
TwipAndPixel
TempTable1 is now a cursor. It is not really a DBF but a temporary file with a semi-random number and a TMP extension.
If you want to append from it into another table you need to use the cursor's real name on disk:
APPEND FROM DBF(Temptable1)
Ours
Selecting into a table doesn't sound to be feasible at all. I'd use a cursor instead. For your case a view sounds to be a better choice. Anyway with a cursor here is a sample that might help:
Public oForm
oForm = Createobject('myForm')
oForm.Show
Define Class myForm As Form
DataSession = 2
Add Object myTxtBox As TextBox
Add Object myGrid As Grid With Top = 30
Procedure Init
With This.myGrid
.RecordSourceType = 4
.RecordSource = "select * from orders"+;
" where cust_id == Upper(thisform.myTxtBox.Value)"+;
" into cursor myCursor readwrite"
Endwith
Endproc
Procedure myTxtBox.LostFocus
With Thisform.myGrid
.RecordSource = .RecordSource
Endwith
Endproc
Enddefine
Ruslan Inozemtsev
Yes the reason is that i use commands for example
=tableupdate
insert into table
delete from
so i dont think the cursor can do these
anyway i thought of a diffrent way that might actually do the thing(but of course doesnt work right so i need your advice)
lets say the grid shows table1
1)select ..from..where..into temptable1
2)append from temptable1
ill should clear table1 first of course but thats easy
when i try this the temptable1 and table1 have the exact same structure .
temptable1 is created successfully with the correct values and fields
BUT append doesnt seem to do anything!according to help it should
add the values of temptable1 in table1
right :):)