refreshing grid problems

I have one DBGrid where I show results from certain queries. In fact the queries are stored procedures written on the oracle server. I try to select records and show the resultset in a dbgrid. On the form I have a listbox with some tablenames in. When I click on one of the items the DBGrid shows the correct result when I use the following code.

var
OraDataset : TOracleDataSet;
cursorquery : TOracleQuery;
datasource : TDataSource;
column, row, offset : integer;
begin

OraDataSet := TOracleDataSet.Create(self);
OraDataSet.Session := DM_CommonDB.conn_CommonDB;
Cursorquery := TOracleQuery.Create(self);
Cursorquery.Session := DM_CommonDB.conn_CommonDB;
Cursorquery.Debug := true;
DataSource := TDataSource.Create(self);
DataSource.DataSet := OraDataSet;
DBGrid1.DataSource := DataSource;
OracleNavigator1.DataSource := DataSource;

with OradataSet do
begin
UpdatingTable := a_UpdateTable;
SQL.Clear;
SQL.add(' THE SQL for selecting the correct table ');
open;
end;

When I try to use a Delphi datamodel and place a TOracleDataSet and TDataSource on it, then the problems starts.
When I click on the listbox, the dbgrid doesn't refresh. All properties in both cases are the same, only the sql has to change like in the procedure above

begin
with DataModule.OracleDataSet1 do
begin

UpdatingTable := a_UpdateTable;
sql.Clear;
SQL.Add(' THE SQL for selecting the correct table ');
open;
end;

end;

What am i doing wrong
Thanks Chris
 
I'm not sure if this is the cause of the problem, but if you call the Open procedure and the dataset is already active, nothing will happen. You will also have to close the dataset.
 
Back
Top