 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Mike Magoo Guest
|
Posted: Fri Sep 12, 2003 12:19 pm Post subject: Strange Access Violation with TADOQuery |
|
|
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
|
Posted: Fri Sep 12, 2003 12:34 pm Post subject: Re: Strange Access Violation with TADOQuery |
|
|
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
|
Posted: Fri Sep 12, 2003 12:54 pm Post subject: Re: Strange Access Violation with TADOQuery |
|
|
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
|
Posted: Fri Sep 12, 2003 1:11 pm Post subject: Re: Strange Access Violation with TADOQuery |
|
|
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 |
|
 |
|
|
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
|
|