Click here to Skip to main content
15,888,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm having a problem in a Crystal Reports application where I am getting no fields in the Fields property on a DatabaseTable Object. Fields.Count returns zero for every table. This is only happening on one of our user's computers. It's working fine for all the developers in the office. We cannot see anything that is different. I'm also wondering if I am doing something that is fundamentally wrong. The documentation says for the Fields property "One object exists in the collection for every database field accessed by the report" but we are seeing one object for every field that exists in the database for each table, not just the ones that are accessed by the report (which BTW is really what we want). We are using CR runtime version 11.5. Seems to do the same with 11.0. Any ideas would be appreciated. Here is the code we're using (Delphi):

Delphi
procedure TfrmPCMSCrystalReportViewer.BuildColumnList;
{ Populate slColumns with the list of column.
  For each table in the report, add every column. }
var
  I, J: Integer;
  Tbl: DatabaseTable;
begin
  slColumns.Clear;
  with crReport1.Database do begin
    for I := 1 to Tables.Count do begin
      Tbl := Tables[I];
      //process each column in table
      for J := 1 to Tbl.Fields.Count do
        //add column to list
        slColumns.Add(Tbl.Fields[J].DatabaseFieldName);
    end; //for
  end; //with
end;
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900