[DUG] Strange access error on application close...

Dave O'Brien dave at ICCS.CO.NZ
Wed Aug 9 11:51:27 NZST 2006


I don't think so, as I said, there are multiple queries in the data
module. It just appears to be that particular one that causes the
problems...
I have checked the properties with the others, and apart from the name,
there doesn't seem to be a difference.

I can get around the problem easily enough, just really wanted to know
why it happens at all.

-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On Behalf Of Robert martin
Sent: Wednesday, 9 August 2006 11:46 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Strange access error on application close...

Hi

I don't know much about ADO but is it that you are trying to unprepare a

blank query? 

Rob Martin
Software Engineer

phone +64 03 377 0495
fax   +64 03 377 0496
web www.chreos.com

Wild Software Ltd



Dave O'Brien wrote:
> Application... (Using DBGo)
> begin
>   Application.CreateForm(TfrmMain, frmMain);
>   Application.CreateForm(TfrmLogin, frmLogin);
>   if frmLogin.ShowModal = mrOK then
>   begin
>     seID := 0 ;
>     datamod.ADOQuery.SQL.Text := 'Select seID from Security...' ;
>     datamod.ADOQuery.Open ;
>     try
>       if not datamod.adoQuery.eof then
>         seID := datamod.ADOQuery.FieldByName('seID').AsInteger
>       else
>         ShowMessage('Invalid Username/Password') ;
>     finally
>       datamod.ADOQuery.Close ;
>     end ;
>     if seID <> 0 then
>       Application.Run ;
>   end ;
> end.
>
> With the above concept code I am getting a strange error.
> "Access violation at address 00490742 in module'test.exe'. Read of
> address 00C628C8"
>
> The error occurs if the login is cancelled, does not occur if the
login
> is OK'd but the username/password is not found, so it has nothing to
do
> with "Running" the app.
>
> If I change the end of the file to:
>
>     if seID <> 0 then
>       Application.Run ;
>   end
>   else
>     datamod.ADOQuery.SQL.Text := 'Anything but a blank string...' ;
> end.
>
> It now exits fine...
> Any idea why I have to assign some text to the query or the app bombs
on
> exit? There are multiple TADOQuery's in the data module, so why don't
I
> have to assign something to each of them? Assigning a value only to
that
> query at design time also resolves the problem.
>
> Cheers,
> Dave.
>
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
>   
_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi



More information about the Delphi mailing list