Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Cannot Load Rows, Get Database Error
Tue, Jul 25 2017 7:34 PMPermanent Link

Andrew Hill

EDBSRVR and EWBSRVR all up and running.

EWB IDE Grid shows columns, Editing DataSet can preview data.

Run fails to load dataset, all attempts to use Database fail.

procedure TForm1.Form1Create(Sender: TObject);
begin
 Database.DatabaseName:= 'Dashboard';  
end;

procedure TForm1.Form1Show(Sender: TObject);
begin
 CallFrequency.Open;
 Database.LoadRows(CallFrequency); // FAILS
end;

Please advise
Wed, Jul 26 2017 9:16 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Andrew,

<< Run fails to load dataset, all attempts to use Database fail. >>

Error message ?

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Jul 26 2017 9:21 PMPermanent Link

Stephen Barker

Tim Young [Elevate Software] wrote:

Andrew,

<< Run fails to load dataset, all attempts to use Database fail. >>

Error message ?

Tim Young
Elevate Software
www.elevatesoft.com

Tim,
I've taken a look at this for Andrew offline. The main problem was the environment options for resources - it was still datasets so changed it to databases. The data is received fine now from EDB via  EWB server.

However another problem is that the data won't appear in a tgrid. If I loop over the data in code and display info in a multiline edit all is fine. When connected to a tgrid it only shows the column headings.

Changing the dataset source to a DBISAM table works fine, just not when using EDB.

Can send example project if needed. But it's just a main form with a tgrid and dataset. I notice your new exampledata doesn't include an EDB database.  I'm just using Andrew's EDB data.

Using 2.06b5


Steve
Wed, Jul 26 2017 9:56 PMPermanent Link

Andrew Hill

Tim Young [Elevate Software] wrote:

Andrew,

<< Run fails to load dataset, all attempts to use Database fail. >>

Error message ?

Tim Young
Elevate Software
www.elevatesoft.com


Your demo fails as well



Attachments: Error-1.jpg
Wed, Jul 26 2017 11:14 PMPermanent Link

Andrew Hill

Andrew Hill wrote:

Tim Young [Elevate Software] wrote:

Andrew,

<< Run fails to load dataset, all attempts to use Database fail. >>

Error message ?

Tim Young
Elevate Software
www.elevatesoft.com


It cannot get any simpler than this

unit Unit1;

interface

uses WebCore, WebUI, WebForms, WebCtrls, WebGrids, WebData;

type

  TForm1 = class(TForm)
     CallFrequency: TDataSet;
     procedure Form1Create(Sender: TObject);
     procedure Form1Show(Sender: TObject);
  private
     { Private declarations }
  public
     { Public declarations }
  end;

var
  Form1: TForm1;

implementation

procedure TForm1.Form1Create(Sender: TObject);
begin
 //
end;

procedure TForm1.Form1Show(Sender: TObject);
begin
 Database.BaseURL:= 'databasemodules/databasemodule';
 Database.DatabaseName:= 'DASHBOARD';  
 CallFrequency.Open;
 Database.LoadRows(CallFrequency);
end;

end.



Attachments: Untitled-3.jpg
Thu, Jul 27 2017 12:34 AMPermanent Link

Stephen Barker

<<Andrew Hill wrote:

procedure TForm1.Form1Show(Sender: TObject);
begin
 Database.BaseURL:= 'databasemodules/databasemodule';  <<-- this is the problem you're seeing now
 Database.DatabaseName:= 'DASHBOARD';  
 CallFrequency.Open;
 Database.LoadRows(CallFrequency);
end;
>>

Andrew,

You don't need all that, just this:

 Database.DatabaseName:='DASHBOARD';  // as named in EWB Database Manager - check this
 Database.LoadRows(CallFrequency);

Steve
Thu, Jul 27 2017 12:45 AMPermanent Link

Stephen Barker

<<Stephen Barker wrote:

However another problem is that the data won't appear in a tgrid. If I loop over the data in code and display info in a multiline edit all is fine. When connected to a tgrid it only shows the column headings.

Changing the dataset source to a DBISAM table works fine, just not when using EDB.
>>

Actually hold this - I just did another small test project with 3 datasets, 3 buttons and a grid. Each button loads a different dataset to the grid. 2 of the datasets are from the ExampleData DBISAM tables, and the third is from Andrew's EDB query. This is working fine (don't know why when the even simpler test projects didn't work).  The only additional thing I'm doing here is clearing out grid columns in between:

procedure TForm1.Form1Create(Sender: TObject);
begin
 Database.AutoTransactions:=False;
 Database.DatabaseName:='ExampleData';
 Database.LoadRows(Albums);
 Database.LoadRows(Products);
 Database.DatabaseName:='Andy';
 Database.LoadRows(CallFrequency);
end;

procedure ClearGrid(grid : TGrid);
var
 i : integer;
begin
 Grid.DataSet := nil;
 for i:=Grid.ColumnCount-1 downto 0 do begin
   Grid.Columns[i].DataColumn := '';
   Grid.RemoveColumn(Grid.Columns[i]);
 end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 ClearGrid(Grid1);
 Grid1.DataSet := Products;
 Grid1.AddColumnsFromDataSet;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 ClearGrid(Grid1);
 Grid1.DataSet := Albums;
 Grid1.AddColumnsFromDataSet;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
 ClearGrid(Grid1);
 Grid1.DataSet := CallFrequency;
 Grid1.AddColumnsFromDataSet;
end;


No need to do anything just now until I can replicate the problem again.

Steve
Thu, Jul 27 2017 10:53 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Stephen,

<< Actually hold this - I just did another small test project with 3 datasets, 3 buttons and a grid. Each button loads a different dataset to the grid. 2 of the datasets are from the ExampleData DBISAM tables, and the third is from Andrew's EDB query. This is working fine (don't know why when the even simpler test projects didn't work).  The only additional thing I'm doing here is clearing out grid columns in between: >>

That's to be expected - if the grid columns were created for a different dataset, then they won't show any data for the current dataset without re-assigning the each grid column's DataColumn property or (what you're doing) clearing them all out and replacing them with the columns from the current dataset.

Tim Young
Elevate Software
www.elevatesoft.com
Image