BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Strange Access Violation with TADOQuery

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Mike Magoo
Guest





PostPosted: Fri Sep 12, 2003 12:19 pm    Post subject: Strange Access Violation with TADOQuery Reply with quote



Hi folks,

I get an Access Violation on the SECOND attempt with the following:

#1 Insert a record [execsql] [insert]
#2 Select last_id [open] [select]
#3 Update Table [execsql] [update]
#4 Insert a record [execsql] [insert]

All of that is hooked up to a button. Now the first time I press the
button, all good. The second time however, I get an access violation. Now
if I create a TADOQuery at runtime (inside the button handler) for the #2
Select instead of using the query placed on the form.. it works.

I didn't include any sql code, becuase I know the SQL is fine (simple sql
query) but I'm using MDAC 2.8 and mySQL and Delphi 7.


Would like to know whats going on though!


Thanks



Back to top
Mike Magoo
Guest





PostPosted: Fri Sep 12, 2003 12:34 pm    Post subject: Re: Strange Access Violation with TADOQuery Reply with quote



please delete

I had the query inside a "with [query] do" block and was tring to change the
Name value.. :(

sry for your time.


"Mike Magoo" <sympatico.ca@hawp> wrote

Quote:
Hi folks,

I get an Access Violation on the SECOND attempt with the following:

#1 Insert a record [execsql] [insert]
#2 Select last_id [open] [select]
#3 Update Table [execsql] [update]
#4 Insert a record [execsql] [insert]

All of that is hooked up to a button. Now the first time I press the
button, all good. The second time however, I get an access violation.
Now
if I create a TADOQuery at runtime (inside the button handler) for the #2
Select instead of using the query placed on the form.. it works.

I didn't include any sql code, becuase I know the SQL is fine (simple sql
query) but I'm using MDAC 2.8 and mySQL and Delphi 7.


Would like to know whats going on though!


Thanks






Back to top
Kevin Frevert
Guest





PostPosted: Fri Sep 12, 2003 12:54 pm    Post subject: Re: Strange Access Violation with TADOQuery Reply with quote



Without the Delphi code you have on the button handler, it's difficult to
say. Is there a reason the component isn't created at design time?

krf

"Mike Magoo" <sympatico.ca@hawp> wrote

Quote:
Hi folks,

I get an Access Violation on the SECOND attempt with the following:

#1 Insert a record [execsql] [insert]
#2 Select last_id [open] [select]
#3 Update Table [execsql] [update]
#4 Insert a record [execsql] [insert]

All of that is hooked up to a button. Now the first time I press the
button, all good. The second time however, I get an access violation.
Now
if I create a TADOQuery at runtime (inside the button handler) for the #2
Select instead of using the query placed on the form.. it works.

I didn't include any sql code, becuase I know the SQL is fine (simple sql
query) but I'm using MDAC 2.8 and mySQL and Delphi 7.


Would like to know whats going on though!


Thanks






Back to top
Mike Magoo
Guest





PostPosted: Fri Sep 12, 2003 1:11 pm    Post subject: Re: Strange Access Violation with TADOQuery Reply with quote

Hi Kevin,

I fixed my error (my own fault), but thanks for taking the time to reply.

FYI, The TADOQuery is created at design time and inside the button handler
was (similar to):

with ADOQuery do
begin
try
with SQL do
begin
Clear;
Add('insert into thisdb (sd, sd) values ('sdf', 'sdfsd')
end;
ExecSQL;
... repeat 3 more times with different sql (select, update, insert)
finally
Close;
end;
end;

"Kevin Frevert" <kevin (AT) workdrinkingcoffee (DOT) com> wrote

Quote:
Without the Delphi code you have on the button handler, it's difficult to
say. Is there a reason the component isn't created at design time?

krf



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.