0

two hours of searching and reading and I am no closer.

Using D5, Zeos v6 SQLite I have Table with the rows displayed in a DBGrid. All fine.

I use

DELETE FROM tblOne WHERE Acct="FirstEntry"

and it deletes the only row that matches. Still all fine - but the DBGrid display stays the same still showing the row just deleted.

I read that closing and opening the TTable assigned to tblOne will refresh the display (as will tblOne.Refresh) which is fine for this test, but sometimes I will not know which Table it is, all I will have is the Table Name. There is no "OPEN", "CLOSE" or "REFRESH" command in SQLite that I can find.

So, how can I refresh the DBGird display to show the record has been deleted?

(edit) I know I can use

dbgrid1.DataSource.DataSet.Refresh;

but, how does one refresh a display using SQL statements? Or is it not possible? (edit)

A short line of code would help to describe the process.

Thanks

Guillem Vicens
  • 3,936
  • 30
  • 44
  • Sorry, my mistake, I will rectify that in a moment. The solution you gave previously is fine when the Table is known, but in my app the user creates a Table-Name of their own at run time. I have no idea what it may be named so I need to be able to use just Text in an SQL query to assign the output to the DBGrid. e.g. (next comment) –  Mar 22 '13 at 22:02
  • SQL.Items.Add('SELECT * FROM '+tblAccount.FieldByName(UserTbl).AsString+' ...'); I then need the DBGrid to be updated. –  Mar 22 '13 at 22:04
  • "I will not know which Table it is" - if you don't know, how can you delete a record from an *unknown* table? – Sir Rufo Mar 22 '13 at 22:15
  • After assigning a new SQL statement, you have to open the dataset. Thats all. – Sir Rufo Mar 22 '13 at 22:18

0 Answers0