Page 1 of 1

Access violation with ExecSQL

Posted: 05.03.2011, 15:22
by belvasis
Hi,

i use version 6.5.1 of zeos since five years now and had only little problems. Now i decided to upgrade to version 6.6 stable. I did it and now nothing works anymore :(
Until now is simply used the following in C++ to execute a statement:

TZQuery* pQuery = new TZQuery(Application);
pQuery->SQL->Add("UPDATE TABLE SET FIELD = 1 WHERE ID = 2");
pQuery->ExecSQL();
delete pQuery;

Simple and it works with 6.5.1 as expected. Now i get an access violation everytime ExecSQL is called.
Has anyone an idea why this happens?

Thanks and regards

Posted: 06.03.2011, 10:58
by Wild_Pointer
Hello belvasis,

I'm not that good familiar with zeos versions before 6.6.X, but should you not assign connection object to pQuery before executing it? How does zeos components know what database you are referring to?

Yes....

Posted: 06.03.2011, 12:09
by belvasis
...you are right, of course. I set the connection in code but missed it here in the code fragment of my post . And the connection object ist valid and connected. I switched back to version 6.5.1 now and all works as expected, without changing any code.

The correct code is:

TZQuery* pQuery = new TZQuery(Application);
pQuery->Connection = pConnection;
pQuery->SQL->Add("UPDATE TABLE SET FIELD = 1 WHERE ID = 2");
pQuery->ExecSQL();
delete pQuery;

Posted: 06.03.2011, 14:21
by Wild_Pointer
belvasis,

please provide some information on what DB you are using. Also have you tried building test application with the source you have provided? Is the result the same as in your older applications?

Posted: 06.03.2011, 21:08
by belvasis
I tried it with an SQLServer 2008 Database. I have no separate test application because this is a really simple use case. After the programm starts, it writes a simple status information to a specific table. This is where the error occurs.

Posted: 07.03.2011, 08:56
by Wild_Pointer
Hello, belvasis,

as zeos does not support protocol to SQLServer you must be using ADO protocol. I have tested on ado protocol and PostgreSql server, and it seems to be ok. On the other hand I'm using Zeos 7 on Delphi. Maybe the error was fixed in v7?... Would you like to try Zeos 7 for your application? I know it is not stable, but we use it in our products with no problems.

Good luck!

Posted: 07.03.2011, 13:08
by belvasis
Hm...that's something i don't understand. In Version 6.5.1 there was an protocol "mssql" and there is a driver MSSqlServer7 in the zeos source. Was this protcol removed? ADO is something i don't want to use. So i think i have to use the older version with c++. The funny thing is, that i upgraded my delphi client app also to version 6.6 and there it works without any problem.

Posted: 08.03.2011, 08:12
by Wild_Pointer
belvasis,

oh sorry. It's totally my fault... Somehow I managed to miss the mssql as I was looking for sqlserver :). I don't have SQL server to play with now, but maybe I will try to find and test zeos 7 with mssql protocol at work.