Page 1 of 1

SOLVED: UniTable.Open gives Access Violation?

Posted: Fri 18 Jan 2013 10:17
by heerdinm
Hello,

I have the following code:

Code: Select all

var
  dsi: TDataSetInfo;
begin

  dsi.UNI           := TUniTable(grd.DataSource.DataSet);
  dsi.UNIConnection := con;
  dsi.SQL           := SQL;
  if not SKAInitDataSet(dsi) then
    ...
    ...

end;


Function OpenDataSet(dsi: TDataSetInfo): Boolean;
begin

  Result := True;

  if dsi.UNI.Active then
    dsi.UNI.Close;

  dsi.UNI.Connection := dsi.UNIConnection;
  dsi.UNI.SQL.Clear;
  dsi.UNI.SQL.Add(dsi.SQL);

  try
    if not dsi.UNIConnection.Connected then
      dsi.UNIConnection.Connect;

    dsi.UNI.Open;
  except
    on E: Exception do
      ShowMessage(E.Message);
  end;

end;
When i run the code, directly after

dsi.UNI.Open;

It runs into the

on E: Exception do

with an AV message.

I have the components on a TDataModule and when i activate them there, they run just fine.
Can anyone please tell me what i am missing in opening a TUniTable in code?

TIA

Re: UniTable.Open gives Access Violation?

Posted: Fri 18 Jan 2013 10:37
by heerdinm
Ok, just me making a mistake again.
I am changing all my code from TADODataSet to use TUniTable and i just forgot to change 1 line of code where i still had TADODAtaSet. No Error on that part, but strangely enough on the .Open of the TUniTable.
Problem solved.