Board index » delphi » Help with using TQuery component with a Field name that has a space in field name.

Help with using TQuery component with a Field name that has a space in field name.

Is it possible to use a Field Name that has a space in it? If so how?

Example:

SQL.Add('Select * form MyTable where My Fieldname = :s');

"My Fieldname" is two words.

Thanks

Alan

 

Re:Help with using TQuery component with a Field name that has a space in field name.


Quote
Alan Stolzman wrote:

> Is it possible to use a Field Name that has a space in it? If so how?

> Example:

> SQL.Add('Select * form MyTable where My Fieldname = :s');

> "My Fieldname" is two words.

> Thanks

> Alan

Try:

SQL.Add('Select * from MyTable where "My Fieldname" = :s');

Re:Help with using TQuery component with a Field name that has a space in field name.


I tried that and I kept getting an error. My original field name was DUE
DATE. I wonder if the DATE was causing the problem?

Quote
> Try:

> SQL.Add('Select * from MyTable where "My Fieldname" = :s');

Re:Help with using TQuery component with a Field name that has a space in field name.


Hi Alan

From what I've seen in the past try

SQL.Add('Select * from MyTable m where m."Due Date" = :s');

Something like that anyway...
HTH
Clint.

Quote
> I tried that and I kept getting an error. My original field name was DUE
> DATE. I wonder if the DATE was causing the problem?

> > Try:

> > SQL.Add('Select * from MyTable where "My Fieldname" = :s');

Other Threads