SQL Statement

Hello all.....is it possible to query a database by 2 fields something like this?......

[code]
DataMod1.EasyFFQ.DisableControls;
DataMod1.EasyFFQ.Close;
DataMod1.EasyFFQ.SQL.Clear;
DataMod1.EasyFFQ.SQL.Add('SELECT * FROM FaceFrame');
DataMod1.EasyFFQ.SQL.Add('WHERE CABNUM = "'+DBLU1.Text+'"');
DataMod1.EasyFFQ.SQL.Add('AND PARTS = Top Rail');<--this fails
DataMod1.EasyFFQ.Open;
DataMod1.EasyFFQ.EnableControls;
[/code]

Thanks for any help.

James

Comments

  • Found the problem....I just needed to add double quotes around Top Rail(s).....


    : Hello all.....is it possible to query a database by 2 fields something like this?......
    :
    : [code]
    : DataMod1.EasyFFQ.DisableControls;
    : DataMod1.EasyFFQ.Close;
    : DataMod1.EasyFFQ.SQL.Clear;
    : DataMod1.EasyFFQ.SQL.Add('SELECT * FROM FaceFrame');
    : DataMod1.EasyFFQ.SQL.Add('WHERE CABNUM = "'+DBLU1.Text+'"');
    : DataMod1.EasyFFQ.SQL.Add('AND PARTS = "Top Rail"');<--Like this
    : DataMod1.EasyFFQ.Open;
    : DataMod1.EasyFFQ.EnableControls;
    : [/code]
    :
    : Thanks for any help.
    :
    : James
    :

  • : Found the problem....I just needed to add double quotes around Top Rail(s).....
    :
    :
    : : Hello all.....is it possible to query a database by 2 fields something like this?......
    : :
    : : [code]
    : : DataMod1.EasyFFQ.DisableControls;
    : : DataMod1.EasyFFQ.Close;
    : : DataMod1.EasyFFQ.SQL.Clear;
    : : DataMod1.EasyFFQ.SQL.Add('SELECT * FROM FaceFrame');
    : : DataMod1.EasyFFQ.SQL.Add('WHERE CABNUM = "'+DBLU1.Text+'"');
    : : DataMod1.EasyFFQ.SQL.Add('AND PARTS = "Top Rail"');<--Like this
    : : DataMod1.EasyFFQ.Open;
    : : DataMod1.EasyFFQ.EnableControls;
    : : [/code]
    : :
    : : Thanks for any help.
    : :
    : : James
    : :
    :
    :

    It's better to use parameters!!!!!!! Otherwise a user might brake your SQL.



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories