Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CommandType Property with SQL Server Express 2005

Status
Not open for further replies.

CarrahaG

Programmer
Mar 25, 2007
98
AW
Hello

We are trying to retrieve some records from an MS SQL Server 2005 Express database.

We are using the statements:

SQLString := 'SELECT * from Entity WHERE Name LIKE ' + QuotedStr(FilterValue);

dmEDS.cdsEDS.Close;
dmEDS.sdsEDS.CommandType := ctQuery;
dmEDS.sdsEDS.CommandText := SQLString;
dmEDS.cdsEDS.Open;
dmEDS.cdsEDS.Refresh;

However, we get the following error during compile:

[Pascal Error] Entities.pas(175):E2003 Undeclared identifier:'ctQuery'

Why is this happening?

Regards,
Georges
 
Have you searched Entities.pas for 'ctQuery'?
According to the error message it's on line 175 and has not been declared as a variable or the declaration is ouside its scope.

Unrelated but does the value assigned to 'FilterValue' contain leading or trailing char '%'?


Roo
Delphi Rules!
 
Hello Roo

Thanks for responding. I was under the impression that ctQuery is a built-in value for the CommandType property of the TSQLDataSet object. If I go to the object inspector and look at the TSQLDataSet object, I can select one of three values for the CommandType property (ctQuery, ctStoredProc, and ctTable). How can I set the CommandType property using Delphi coding and not the Object Inspector.

Regarding, the other point you mentioned about leading and trailing '%' for the filter value. You are correct. I had noticed my mistake with that after I had posted my message.

Regards,
Georges
 
just add DB to the units list and it will recognize ctQuery...

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Hello

This worked. Thanks alot!

Regards,
Georges
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top