#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    5
    Rep Power
    0

    How to remove the Quotes from the String?


    Hi to All:

    I am new to the delphi...

    i am doing customized query developing for my sql, i have doubt on that...
    pls.. clear my doubt...

    i have a selected query from the listbox, that string is
    var
    Qry : string;

    Qry := 'F_FirstName = 'Dhanu'';{ This is my Qry.. i need to add this condition to my Qry at runtime...}

    Qry.sql.add( 'select *from table where',+Qry); { its output is getting error out put is like (select *from table where ''F_FirstName = ''Dhanu'''')}

    this Qurey cannot be excuted...

    Please help me to solve this...
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2009
    Posts
    59
    Rep Power
    5
    First, to check -
    You've got the variable Qry set as a string, but you appear to be calling it as though it were a database connection query component (Qry.sql.add) - which of these is accurate?

    Second, my own recommendation for the scenario you're describing (if I'm understanding it correctly) would be this:

    Code:
    Qry := 'select * from table where F_FirstName = ' + QuotedStr('Dhanu');
    
    Qry.sql.add(Qry);
    I hope this helps.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    350
    Rep Power
    7
    Another option is to use parameters
    Code:
    Qry.sql.add('select * from table where F_FirstName = :paramfName');
    Qry.ParamByName('paramfName').value = 'Dhanu';
    Qry.Open;
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    5
    Rep Power
    0

    Regards thanks


    Thanks for ur guidance... i got idea from ur Coding.. really thks fro u....

IMN logo majestic logo threadwatch logo seochat tools logo