Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

Bordbk105N - Assertion failure.

edited March 2010 in End User

In Delphi 2007, and RB11, I am using a TClientDataset to create mailing
labels from data in a DevEx Grid. Yesterday, I ran this section of code
numerous times with no problem. Today I get and Assertion failure which
results in an Access Violation. When I say "today" I mean the first thing
this morning but it worked fine last night.

Message caption: *bds.exe - bordbk105N.dll*
Message text : *Assertion failure: "index <= items.n()" in
..\win32src\DBKIMPL.CPP at line 2672. Continue execution?*

If I click "No" to the question "Continue execution?" Delphi closes. It
seems to be related to the creation of only this one RB report, because
other RB reports work fine.

At the risk of providing too much information, here is my code:

procedure TdlgCampaigns.btnMailingLabelsClick(Sender: TObject);
Var
reg : TRegistry;
s: string;
Const
ABSKey: String = 'my registry key';

begin
{ Get Label Preferences. }
Reg := TRegistry.Create(KEY_READ);
try
{Determine Registry Root key.}
Reg.RootKey := HKEY_LOCAL_MACHINE;

{ABSKey will force standardization }
if Reg.OpenKey(ABSKey + 'Run-Time Options', False) then
begin
try
Reg.RootKey := HKEY_LOCAL_MACHINE ;
s := Reg.ReadString ('Address Labels');
finally
FreeAndNil(Reg);
end;
end;
finally
end;

{ Create fields in Client Dataset }
With CampaignClientDS do begin
if Active then Close;
try
{ Clear any fields left over from the last query}
FieldDefs.Clear;
FieldDefs.Add('Entity',ftString,80,False) ;
FieldDefs.Add('Client',ftString,45,False) ;
FieldDefs.Add('Address1',ftString,50,False) ;
FieldDefs.Add('Address2',ftString,50,False) ;
FieldDefs.Add('CSZ',ftString,40,False) ;
CreateDataSet ;

{ Get data from all rows of a DevEx Grid. "ForEachRow" loops through
all the rows after filtering.}
cxGrid_RecipientsDBTableView1.ViewData.DataController.ForEachRow(False,GetLabelData);
first;

{ Do the report. }
if s = '5160' then begin
with rptAvery5160_Campaigns do begin
PrinterSetup.DocumentName := 'Mailing Labels';
ResolvePipelineReferences();
Print; {----------------------------This is where the error
happens-------------}
end;
end else begin
with rptAvery5161_Campaigns do begin
PrinterSetup.DocumentName := 'Mailing Labels';
ResolvePipelineReferences();
Print; {----------------------------This is where the error
happens-------------}
end;
end;
finally
if Active then Close;
end;
end;
end;





--
_______________________________
Homer W. Jones
Homer@agencybusys.com
www.agencybusys.com


"If you want a better answer, ask a better question."
Prof. Pat Atteberry,
Oregon State University

Comments

  • edited March 2010
    Hi Homer,

    We have not seen or heard of this error before. Do you only receive this
    error when running the application inside the Delphi IDE?

    A quick search online gave the following results. Numerous people claim
    that it is caused by the DEP (Data Execution Prevention) security feature of
    Windows. If you have this enabled, you might try disabling it for Delphi
    2007 and see if that helps.

    http://qc.embarcadero.com/wc/qcmain.aspx?d=32047

    http://en.wikipedia.org/wiki/Data_Execution_Prevention

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2010
    I have no clue as to how to disable DEP. However, it doesn't make sense to
    me that DEP would cause this with only one TppReport when there are at least
    12 others that have no problem. Please explain. Also, do you think I should
    just delete the TppReport in question and start over?




  • edited March 2010
    Hi Homer,


    You're correct, sorry I must have missed that tidbit.

    Perhaps try simplifying the report that causes the error to try to isolate
    which component or feature is causing the problem. Try to focus on the
    difference between the reports that do work and the report that does not.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2010
    I don't know how I can make the report much more simple. It was made with
    the Report Builder template for Avery 5160 labels. There are simple 5 DBText
    fields. How do you suggest I simplify it?

    Remember that one day it worked, the next it didn't. I'm very puzzled.




  • edited April 2010
    Hi Homer,

    This is very puzzling, especially since we have never heard of anyone else
    having this issue in the past.

    1. Since the report is fairly simple, try recreating it from scratch and
    see if you still get the error.
    2. If you do, try removing any data aware components and see if they are
    causing the problem.
    3. Finally create a simple example that demonstrates the issue that I can
    run on my machine and send it to support@digital-metaphors.com in .zip
    format so I can try on my machine.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2010

    I Googled about this error, looks like it is related to the Delphi debugger.
    The workaround mentions a slightly different named dll (120 rather than 105,
    but in the comments a developer mentions the 105 dll.

    http://www.monien.net/blog/index.php/2009/07/delphi-2009-windows-7-64-bit-debugger-crash-workaround/


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.