Jump to content


Photo

Access violation in TNextDBGrid


  • Please log in to reply
3 replies to this topic

#1 APIA Codewarriors

APIA Codewarriors
  • Members
  • 2 posts

Posted 13 November 2008 - 12:49 PM

Hello,

I found a problem in TNextDBGrid componet when I have a Calculated column in my dataset and the columns have been retrieved directly at runtime ( no column added at design-time in the grid ), opening the dataset I get an Access violation in NxDBGridRun.bpl package...

In order to fix the problem I added the red rows in unit NxDBGrid.pas procedure TNextDBGrid.CreateColumns

...
case AField.FieldKind of
fkCalculated:
ColumnClass := TNxDBCalcColumn;

fkData:
...

Could you include this little change also in your version? ( or something like that will solve the problem )

Thanks
Bye

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 13 November 2008 - 04:26 PM

Hello Apia,

I will add it. It will be included in next release.

regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 Qwazerty

Qwazerty
  • Members
  • 73 posts
  • Gender:Male
  • Location:France

Posted 25 March 2016 - 04:07 PM

Hi Boki

 

There's always an issue about that, but it' seems to me that fkCalculated doesn't need a specific Column type , an FieldData with "fkCalculated" isn't numeric all the time, a "TBooleanField" for exemple can be a calculted field.

 

 

In NxDBGrid.Pas in CreateColumns, I add fkCalculated because I need it but other FieldKind type need to appear too.

procedure TNextDBGrid.CreateColumns;
var
    I: Integer;
AColumn: TNxDBCustomColumn;
AddColumn: Boolean;
AField: TField;
ColumnClass: TNxDBColumnClass;
begin
if doAddIncrementColumn in DataAwareOptions
then Columns.Add(TNxDBIncrementColumn, True);
    for i := Columns.Count to FDataLink.DataSet.FieldCount - 1 do
begin
AField := FDataLink.DataSet.Fields[i];
case AField.FieldKind of
fkData, fkCalculated:
case AField.DataType of
ftString, ftUnknown, ftTime, ftWideString, ftGuid,
ftFixedChar: ColumnClass := TNxDBTextColumn;
ftFloat, ftInteger, ftSmallint, ftWord, ftCurrency, ftAutoInc,
ftLargeint, ftBCD, ftFmtBCD: ColumnClass := TNxDBNumberColumn;
ftMemo, ftFmtMemo: ColumnClass := TNxDBTextColumn;
ftBoolean: ColumnClass := TNxDBCheckBoxColumn;
ftDate, ftDateTime: ColumnClass := TNxDBDateColumn;
ftGraphic, ftBytes, ftVarBytes: ColumnClass := TNxDBGraphicColumn;
else ColumnClass := TNxDBTextColumn;
end;
fkLookup: ColumnClass := TNxLookupColumn;
end;

Have a nice day

Qwaz



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 27 March 2016 - 01:08 AM

Hi Qwaz,

I will see if your tweak can fit into official release and include it.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users