Welcome, Guest
Username: Password: Remember me
Components and Libraries for Database Development, discussions, problems and suggestions
  • Page:
  • 1

TOPIC:

ODBC for MSSQL Cannot open a non-select statement 11 years 5 months ago #4193

  • Luca
  • Luca's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 2
I tried to recompile an application developed using CT 2.9.
It uses an ODBC connectin to MSSQL server.
Recompilation is OK but when I activate a query (SELECT * from...) I received this error:
"qry: Cannot open a non-select statement".
I tried to create a new empty project with just ODBC Connection, SQL Transaction and a SQLQuery with a SELECT statement but I received same error.
I set PacketRecords to -1, ParseSQL to False and UsePrimaryKeyAsKey to False with no result.

Please help me.
Thanks
Luca

Please Log in or Create an account to join the conversation.

ODBC for MSSQL Cannot open a non-select statement 11 years 5 months ago #4204

  • Szafran
  • Szafran's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
I have exactly the same thing but with MySQL.

This is a console app.
uses
  cthreads,
  (...) 
  SQLdb, MySQL55conn;

(...)

procedure blah;
var
  MySQLconnection : TMySQL55Connection;
  MySQLtransaction : TSQLTransaction;
  MySQLquery : TSQLQuery;

begin
  MySQLconnection := TMySQL55Connection.Create( nil );
  MySQLtransaction := TSQLTransaction.Create( nil );
  MySQLquery := TSQLQuery.Create( nil );

  MySQLconnection.Transaction := MySQLtransaction;
  MySQLtransaction.DataBase := MySQLconnection;
  MySQLquery.DataBase := MySQLconnection;
  MySQLquery.Transaction := MySQLtransaction;
  MySQLquery.ParseSQL := False;

  MySQLconnection.HostName := 'localhost';
  MySQLconnection.Port := 3306;
  MySQLconnection.UserName := 'user';
  MySQLconnection.Password := 'pass';
  MySQLconnection.DatabaseName := 'dbname';

  MySQLconnection.Open;
  MySQLtransaction.StartTransaction;

  MySQLquery.SQL.Clear;
  MySQLquery.SQL.Add( 'SELECT * FROM seriale_ustawienia' );
  MySQLquery.Open;                        <===== dies here with that non-select exception
  while ( not MySQLquery.EOF ) do
    begin

(...)

end;

Anyone knows what's wrong ?

Please Log in or Create an account to join the conversation.

ODBC for MSSQL Cannot open a non-select statement 11 years 5 months ago #4207

  • Szafran
  • Szafran's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
I have found a solution to my problem, which is provided here: Link

Please Log in or Create an account to join the conversation.

ODBC for MSSQL Cannot open a non-select statement 11 years 5 months ago #4214

  • Luca
  • Luca's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 2
OK for SQL Select statement.
Now If I run and Update query application hangs.

I started debug and the problem seems to be in TODBCConnection.Execute procedure in the
Case else step: Res:=SQLExecute(ODBCCursor.FSTMTHandle)

I supposed it's linked to ODBCCursor problem.

Thanks for help.

Please Log in or Create an account to join the conversation.

ODBC for MSSQL Cannot open a non-select statement 11 years 4 months ago #4226

  • Luca
  • Luca's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 33
  • Thank you received: 2
:( After some tests, I returned back to CT 3.00.
I hope that CT 4.4 will fix this issue using a different FPC version.

Regards

Please Log in or Create an account to join the conversation.

  • Page:
  • 1