Re: Strings

"Felipe Rezek Mohallem" <[email protected]>
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <[email protected]>
Olá, Eduardo!
The best way to do this is using parameters.
If you open the query many times, it's already prepared.
So, try this:

qry.Sql.Clear;
qry.Sql.Add ( 'SELECT * FROM TABLE WHERE FIELD == :MYPARAM' );
qry.ParamByname ( 'MYPARAM' ).AsString :== edit1.text;
qry.Open;

If you want to use the query without params, try the folowing.
// if you're using string fields
qry.Sql.Clear;
qry.Sql.Add ( 'SELECT * FROM TABLE WHERE FIELD == ' + QuotedStr ( edit1.text ) );
qry.Open;

// if you're using integer, float, currency fields
qry.Sql.Clear;
qry.Sql.Add ( 'SELECT * FROM TABLE WHERE FIELD == ' + edit1.text );
qry.Open;

Best reggards,
Felipe

  ----- Original Message ----- 
  From: Eduardo Meyer 
  To: Delphi Programming 
  Sent: Wednesday, July 23, 2003 4:53 PM
  Subject: [Delphi] Strings


  Hi people!


      I'm in a trouble with a string concatenation..
  I mean, I'm trying to make an SQL Query in a string var...

  This the problem:
  strQuery == 'SELECT * FROM TABLE WHERE FIELD==' ??? Edit1.Text
  I would like to get the text of this TEdit, but how if ( ' ) limits the string??


  How confusing was my explanation!
  LOL

  Sorry...

  Thanks!


  Eduardo

  [Non-text portions of this message have been removed]


        Yahoo! Groups Sponsor 
       
       

  CodeCoffer - new Delphi code protection Tool!
  http://www.delphicollection.com/public/CodeCoffer.htm
  ---------------------------------------------------------------
  Unsubscribe:[email protected]
  List owner:[email protected]
  --------------------------------------------------------------- 

  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Free shipping on all inkjet cartridge & refill kit orders to US & Canada. Low prices up to 80% off. We have your brand: HP, Epson, Lexmark & more.
http://www.c1tracking.com/l.asp?cid=5510
http://us.click.yahoo.com/GHXcIA/n.WGAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->

CodeCoffer - new Delphi code protection Tool!
http://www.delphicollection.com/public/CodeCoffer.htm
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.