Board index » delphi » Access violation in module 'msjet40.dll'

Access violation in module 'msjet40.dll'

Even though I'm using C++ Builder 5 with the ADOExpress package I thought
maybe someone can shed some light on the following problem.

I have the following connection...

    ADOMyConnection->ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data
Source=MyDataBase.mdb;Persist Security Info=False";

And I try to execute a query with the following SQL...

ADOFindMaxDateQ->SQL->Add("SELECT MAX(TheTable.Date) AS Expr1");
ADOFindMaxDateQ->SQL->Add("FROM TheTable");
ADOFindMaxDateQ->Open()

I get the following access violation...

'Access violation at address 1B03F511 in module 'msjet40.dll'.  Read of
address 0000242E'

Right at the first line 'SELECT MAX(TheTable.Date) AS Expr1'.  I've also
tried using an ADODataSet giving me the exact same Access Violation at the
same SQL line.  Any thoughts would be appreciated.

 

Re:Access violation in module 'msjet40.dll'


Are you creating the Query component?  That's what the AV is about.. you're
trying to reference an object that doesn't exist or has already been
destroyed.

--
David Reed
White Plains, Maryland USA
www.diamondsg.com
www.oasisrep.com
*To reply, remove the no_spam from my email address
*To view file attachment(s), remove underscore from file extension

Quote
Robert Vasquez <rvasq...@prodigy.net> wrote in message

news:393013d9@dnews...
Quote
> Even though I'm using C++ Builder 5 with the ADOExpress package I thought
> maybe someone can shed some light on the following problem.

> I have the following connection...

>     ADOMyConnection->ConnectionString =
> "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data
> Source=MyDataBase.mdb;Persist Security Info=False";

> And I try to execute a query with the following SQL...

> ADOFindMaxDateQ->SQL->Add("SELECT MAX(TheTable.Date) AS Expr1");
> ADOFindMaxDateQ->SQL->Add("FROM TheTable");
> ADOFindMaxDateQ->Open()

> I get the following access violation...

> 'Access violation at address 1B03F511 in module 'msjet40.dll'.  Read of
> address 0000242E'

> Right at the first line 'SELECT MAX(TheTable.Date) AS Expr1'.  I've also
> tried using an ADODataSet giving me the exact same Access Violation at the
> same SQL line.  Any thoughts would be appreciated.

Re:Access violation in module 'msjet40.dll'


"Date" is a function name in JET. Try the following:

SELECT MAX([TheTable].[Date]) AS Expr1

HTH
--
V. Nazarov
IT Manager, Sofia Cable

Quote
"Robert Vasquez" <rvasq...@prodigy.net> wrote in message news:393013d9@dnews...
> Even though I'm using C++ Builder 5 with the ADOExpress package I thought
> maybe someone can shed some light on the following problem.

> I have the following connection...

>     ADOMyConnection->ConnectionString =
> "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data
> Source=MyDataBase.mdb;Persist Security Info=False";

> And I try to execute a query with the following SQL...

> ADOFindMaxDateQ->SQL->Add("SELECT MAX(TheTable.Date) AS Expr1");
> ADOFindMaxDateQ->SQL->Add("FROM TheTable");
> ADOFindMaxDateQ->Open()

> I get the following access violation...

> 'Access violation at address 1B03F511 in module 'msjet40.dll'.  Read of
> address 0000242E'

> Right at the first line 'SELECT MAX(TheTable.Date) AS Expr1'.  I've also
> tried using an ADODataSet giving me the exact same Access Violation at the
> same SQL line.  Any thoughts would be appreciated.

Re:Access violation in module 'msjet40.dll'


Yes, the query object is created if I modify the SQL to look like this...

ADOFindMaxDateQ->SQL->Add("SELECT *");
ADOFindMaxDateQ->SQL->Add("FROM TheTable");
ADOFindMaxDateQ->Open()

the query works.  It seems it only occurs when I have the key word 'MAX'.

Quote
"David Reed" <davidr...@worldnet.att.net> wrote in message

news:8gr7ge$maq7@bornews.borland.com...
Quote

> Are you creating the Query component?  That's what the AV is about..
you're
> trying to reference an object that doesn't exist or has already been
> destroyed.

> --
> David Reed
> White Plains, Maryland USA
> www.diamondsg.com
> www.oasisrep.com
> *To reply, remove the no_spam from my email address
> *To view file attachment(s), remove underscore from file extension

> Robert Vasquez <rvasq...@prodigy.net> wrote in message
> news:393013d9@dnews...
> > Even though I'm using C++ Builder 5 with the ADOExpress package I
thought
> > maybe someone can shed some light on the following problem.

> > I have the following connection...

> >     ADOMyConnection->ConnectionString =
> > "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data
> > Source=MyDataBase.mdb;Persist Security Info=False";

> > And I try to execute a query with the following SQL...

> > ADOFindMaxDateQ->SQL->Add("SELECT MAX(TheTable.Date) AS Expr1");
> > ADOFindMaxDateQ->SQL->Add("FROM TheTable");
> > ADOFindMaxDateQ->Open()

> > I get the following access violation...

> > 'Access violation at address 1B03F511 in module 'msjet40.dll'.  Read of
> > address 0000242E'

> > Right at the first line 'SELECT MAX(TheTable.Date) AS Expr1'.  I've also
> > tried using an ADODataSet giving me the exact same Access Violation at
the
> > same SQL line.  Any thoughts would be appreciated.

Re:Access violation in module 'msjet40.dll'


The error still occurs.  It appears that it only occurs when I use the key
word 'MAX'.

Quote
"Vassil Nazarov" <s...@bulnet.bg> wrote in message news:393127fc@dnews...
> "Date" is a function name in JET. Try the following:

> SELECT MAX([TheTable].[Date]) AS Expr1

> HTH
> --
> V. Nazarov
> IT Manager, Sofia Cable

> "Robert Vasquez" <rvasq...@prodigy.net> wrote in message

news:393013d9@dnews...
Quote
> > Even though I'm using C++ Builder 5 with the ADOExpress package I
thought
> > maybe someone can shed some light on the following problem.

> > I have the following connection...

> >     ADOMyConnection->ConnectionString =
> > "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data
> > Source=MyDataBase.mdb;Persist Security Info=False";

> > And I try to execute a query with the following SQL...

> > ADOFindMaxDateQ->SQL->Add("SELECT MAX(TheTable.Date) AS Expr1");
> > ADOFindMaxDateQ->SQL->Add("FROM TheTable");
> > ADOFindMaxDateQ->Open()

> > I get the following access violation...

> > 'Access violation at address 1B03F511 in module 'msjet40.dll'.  Read of
> > address 0000242E'

> > Right at the first line 'SELECT MAX(TheTable.Date) AS Expr1'.  I've also
> > tried using an ADODataSet giving me the exact same Access Violation at
the
> > same SQL line.  Any thoughts would be appreciated.

Re:Access violation in module 'msjet40.dll'


I have executed successfully the following SQL in Delphi:

SELECT
    Max(PLAstabONAT.DatePlast) AS MaxOfDatePlast
FROM
    PLAstabONAT

Quote
> Yes, the query object is created if I modify the SQL to look like this...
> ADOFindMaxDateQ->SQL->Add("SELECT *");
> ADOFindMaxDateQ->SQL->Add("FROM TheTable");
> ADOFindMaxDateQ->Open()
> the query works.  It seems it only occurs when I have the key word 'MAX'.

"SELECT TheTable.Date FROM TheTable" would also produce an error.

Play around with the hard quotes.

HTH
--
V. Nazarov
IT Manager, Sofia Cable

Quote
"Robert Vasquez" <rvasq...@prodigy.net> wrote in message news:39315d49@dnews...
> The error still occurs.  It appears that it only occurs when I use the key
> word 'MAX'.

> "Vassil Nazarov" <s...@bulnet.bg> wrote in message news:393127fc@dnews...
> > "Date" is a function name in JET. Try the following:

> > SELECT MAX([TheTable].[Date]) AS Expr1

> > HTH
> > --
> > V. Nazarov
> > IT Manager, Sofia Cable

> > "Robert Vasquez" <rvasq...@prodigy.net> wrote in message
> news:393013d9@dnews...
> > > Even though I'm using C++ Builder 5 with the ADOExpress package I
> thought
> > > maybe someone can shed some light on the following problem.

> > > I have the following connection...

> > >     ADOMyConnection->ConnectionString =
> > > "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data
> > > Source=MyDataBase.mdb;Persist Security Info=False";

> > > And I try to execute a query with the following SQL...

> > > ADOFindMaxDateQ->SQL->Add("SELECT MAX(TheTable.Date) AS Expr1");
> > > ADOFindMaxDateQ->SQL->Add("FROM TheTable");
> > > ADOFindMaxDateQ->Open()

> > > I get the following access violation...

> > > 'Access violation at address 1B03F511 in module 'msjet40.dll'.  Read of
> > > address 0000242E'

> > > Right at the first line 'SELECT MAX(TheTable.Date) AS Expr1'.  I've also
> > > tried using an ADODataSet giving me the exact same Access Violation at
> the
> > > same SQL line.  Any thoughts would be appreciated.

Re:Access violation in module 'msjet40.dll'


Quote
> Play around with the hard quotes.

Should be:

Play around with the hard brackets.

--
V. Nazarov
IT Manager, Sofia Cable

Other Threads