Recent

Author Topic: Problem with TSQLQuery  (Read 4467 times)

Soniak

  • Newbie
  • Posts: 3
Problem with TSQLQuery
« on: November 29, 2006, 07:09:31 pm »
Hello
Problem beguile with TSQLQuery after interrogation query:

      SQLQuery1.SQL.Clear;
      SQLQuery1.SQL.Add( '"SELECT * FROM TEST;"' );
      SQLQuery1.Open;

Application reports error  :

SQLQuery1 : Cannot open a non-select statement

In inspector of object SQLQuery1 I can not change parameter StatementType it returns after change on other always for stNone

It thanks from mountain for assistance

(On configuration : WinXP, MYSql 5, Lazarus 0.9.18Beta )

Soniak

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: Problem with TSQLQuery
« Reply #1 on: November 30, 2006, 08:30:22 am »
I presume you have SQLQuery properly connect to SQLConnection and SQLDatabase. Then the follwoing code should work:
Code: [Select]

 SQLQuery1.SQL.Clear;
 SQLQuery1.SQL.Add('select * from test');
 // Other possibility  SQLQuery1.Text := 'select * from test';
 SQLQuery1.Open

Your error might be in the number of quotes, because in your sample the SQL text which is parsed starts and ends with a quote. So the parser things you are sendign some string to database.

(Maybe an other error message would be more clear. :) )
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

 

TinyPortal © 2005-2018