Hello Boki,
trying to use NextDbGrid with a LookupColumn - from this moment i have lot's of AV's, not only when running the program, also every time i stop the program and in the IDE too.
One of the errors i have found here: when i close the program the error occurs in NxDBColumns.pas in procedure "TLookupDataLink.ActiveChanged", where it checks if DataSet is active, but DataSet is nil ...
I use latest version of Next Suite and D7 pro.
thanks,
Helmut
lot of AV's when using NxLookupColumn
Started by user22, Feb 06 2011 03:02 AM
5 replies to this topic
#1
Posted 06 February 2011 - 03:02 AM
#2
Posted 08 February 2011 - 05:31 PM
I noticed the same here as well.
I had a NextDbGrid ( v5111, Unicode ) with two columns using DbLookupColumns in a frame.
I got an access violation as soon as the destructor tried to free the frame.
Clearing the datasources for the lookup-columns didn't help either.
I did manage to contain the error within a try/except in the destructor.
I had a NextDbGrid ( v5111, Unicode ) with two columns using DbLookupColumns in a frame.
I got an access violation as soon as the destructor tried to free the frame.
Clearing the datasources for the lookup-columns didn't help either.
I did manage to contain the error within a try/except in the destructor.
#3
Posted 08 February 2011 - 09:49 PM
Hello,
I will check this. It is strange, since I didn't change anything in here.
Please sorry for this problem
Best regards
I will check this. It is strange, since I didn't change anything in here.
Please sorry for this problem
Best regards
boki@bergsoft.net
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.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.
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.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.
#4
Posted 09 February 2011 - 01:55 PM
QUOTE (Boki (Berg) @ Feb 8 2011, 09:49 PM) <{POST_SNAPBACK}>
Hello,
I will check this. It is strange, since I didn't change anything in here.
Please sorry for this problem
Best regards
I will check this. It is strange, since I didn't change anything in here.
Please sorry for this problem
Best regards
I've stumbled upon a solution/fix.
By closing and freeing the table associated to the ListDataSource for the LookupColumn the access violation is gone.
I did this in the destructor for the frame I had the grid in.
#5
Posted 09 February 2011 - 08:19 PM
QUOTE (rond @ Feb 9 2011, 01:55 PM) <{POST_SNAPBACK}>
I've stumbled upon a solution/fix.
By closing and freeing the table associated to the ListDataSource for the LookupColumn the access violation is gone.
I did this in the destructor for the frame I had the grid in.
By closing and freeing the table associated to the ListDataSource for the LookupColumn the access violation is gone.
I did this in the destructor for the frame I had the grid in.
Hello Rond,
Can you please send me a sample code that you do, to I integrate it into grid.
Best regards
boki@bergsoft.net
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.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.
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.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.
#6
Posted 10 February 2011 - 10:21 AM
QUOTE (Boki (Berg) @ Feb 9 2011, 08:19 PM) <{POST_SNAPBACK}>
Hello Rond,
Can you please send me a sample code that you do, to I integrate it into grid.
Best regards
Can you please send me a sample code that you do, to I integrate it into grid.
Best regards
I didn't modify any of your controls.
I only changed the order in which I destroy/close the list-source in my frame, which looks a bit like this :
CODE
TfrShiftProducts = class(TFrame)
private
FProductSelectionItems: TAdoQuery;
public
Constructor Create(AOwner : TComponent); override;
Destructor Destroy; override;
end;
...
constructor TfrShiftProducts.Create(AOwner: TComponent);
begin
inherited;
FProductDataSource := TDataSource.Create(Nil);
FProductSelectionItems := TAdoQuery.Create(Nil);
FProductSelectionItems.LockType := ltReadOnly;
FProductSelectionItems.ConnectionString := datMsSql.ConnectionString;
FProductSelectionItems.SQL.Clear;
// I build query for listbox here (the actual query is a bit more complex, but this is the basic idea :
FProductSelectionItems.SQL.Add("SELECT PrCode, PrNaam FROM OEE_PR");
//
// and linked the list to the column like this :
FProductDataSource.DataSet := FProductSelectionItems;
colProductDescriptions.ListDataSource := FProductDataSource;
colProductDescriptions.KeyFieldName := 'PrCode';
colProductDescriptions.ListFieldName := 'PrNaam';
// the grid uses a query as a datasource, which contains a field named 'PrCode'
end;
destructor TfrShiftProducts.Destroy;
begin
try
// this is the bit I have which appears to have solved the issue for me :
if (Nil <> FProductSelectionItems) then
begin
if FProductSelectionItems.Active then
begin
FProductSelectionItems.Close;
end;
FreeAndNil(FProductSelectionItems);
end;
// ---
if FProducts.Active then
FProducts.Close;
if Assigned(FProductDataSource) then
begin
grdShiftProducts.DataSource := Nil;
// this bit appeared to cause the exception somewhere in the component :
colProductDescriptions.ListDataSource := Nil;
FreeAndNil(FProductDataSource);
// ---
end;
except
on E : Exception do // at first I simply caught the exception
begin
Fc.SystemEventLogger.Exception(E);
end;
end;
inherited;
end;
...
private
FProductSelectionItems: TAdoQuery;
public
Constructor Create(AOwner : TComponent); override;
Destructor Destroy; override;
end;
...
constructor TfrShiftProducts.Create(AOwner: TComponent);
begin
inherited;
FProductDataSource := TDataSource.Create(Nil);
FProductSelectionItems := TAdoQuery.Create(Nil);
FProductSelectionItems.LockType := ltReadOnly;
FProductSelectionItems.ConnectionString := datMsSql.ConnectionString;
FProductSelectionItems.SQL.Clear;
// I build query for listbox here (the actual query is a bit more complex, but this is the basic idea :
FProductSelectionItems.SQL.Add("SELECT PrCode, PrNaam FROM OEE_PR");
//
// and linked the list to the column like this :
FProductDataSource.DataSet := FProductSelectionItems;
colProductDescriptions.ListDataSource := FProductDataSource;
colProductDescriptions.KeyFieldName := 'PrCode';
colProductDescriptions.ListFieldName := 'PrNaam';
// the grid uses a query as a datasource, which contains a field named 'PrCode'
end;
destructor TfrShiftProducts.Destroy;
begin
try
// this is the bit I have which appears to have solved the issue for me :
if (Nil <> FProductSelectionItems) then
begin
if FProductSelectionItems.Active then
begin
FProductSelectionItems.Close;
end;
FreeAndNil(FProductSelectionItems);
end;
// ---
if FProducts.Active then
FProducts.Close;
if Assigned(FProductDataSource) then
begin
grdShiftProducts.DataSource := Nil;
// this bit appeared to cause the exception somewhere in the component :
colProductDescriptions.ListDataSource := Nil;
FreeAndNil(FProductDataSource);
// ---
end;
except
on E : Exception do // at first I simply caught the exception
begin
Fc.SystemEventLogger.Exception(E);
end;
end;
inherited;
end;
...
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











