Access violation on TDatabase.Execute

Access violation on TDatabase.Execute

Post by Markus Wagne » Thu, 13 Jun 2002 18:15:30



Hi,

I have a strange problem with the method TDatabase.Execute.

When I pass a string constant, it works:

sql := 'INSERT INTO table (field1,field2) VALUES (1,'Test')';
db.Execute(sql);

But as soon as I build the string out of other strings, it crashes:

sql := 'INSERT INTO table (field1,field2) VALUES (' + sf1 + ',''' + sf2 +
''')';
db.Execute(sql);

I get an exception:

access violation in module IDAPI32.DLL, reading from 0000000B.

What can I do about this?

Thank you very much,

Markus

PS: the database system is PostgreSQL

 
 
 

Access violation on TDatabase.Execute

Post by Dirk Mik » Thu, 13 Jun 2002 21:05:13


Hi,

Quote:> But as soon as I build the string out of other strings, it crashes:

> sql := 'INSERT INTO table (field1,field2) VALUES (' + sf1 + ',''' + sf2 +
> ''')';
> db.Execute(sql);

Does "sql" contains the right string, after putting it together?
--> ShowMessage(sql);

Regards
Dirk Mika

 
 
 

Access violation on TDatabase.Execute

Post by jobrego » Thu, 07 Nov 2002 06:03:04


Hi

This is the way I solve the problem.
Since the TDatabase.Execute method expects a constant,
I did :

dc.Execute(sql+' ',Nil,False,Nil);   {  add an empty string }

Hope It works for you.

--
Posted via http://dbforums.com

 
 
 

1. access violation error with tdatabase

Hi,

I have an access violation problem with the tdatabase component.
Currently, I am using an odbc connection to an "M.S. Acess" database under
N.T 4.0.

Using the tdatabase component and my odbc connection to the "access"
tables under NT4.0, I keep getting access violation.  I wrote a program
with a tdatabase component on it that connect to the access database.
The first time I run the application, it works fine. However, once
I quit the program, then restart, then quit.  I get an access violation
error.  I tried to run it under windows 95 and everything works fine.

can anyone help me with this
vincent

2. What DBMS to use with SAP?

3. Access violation when executing my own extended stored procedure

4. 2 Questions on SQL2K Cluster

5. Access violation when executing SQL

6. OCI and GNU-C-Compiler

7. DrWatson when jdbc access - Access violation (access to address 0x00005)

8. Problem with Access 97 & TDatabase

9. MS Access with TDatabase?

10. Access 97 & TDatabase

11. How to catch database access (from TDatabase)?

12. TDatabase field access?