Board index » delphi » Tquery and runtime parameters
Graeme Cox
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
|
Graeme Cox
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Tquery and runtime parameters
Greetings,
Problem : I am trying to pass runtime values into a tquery... it all for example.. MySql.SQL.Add('Select * from tbl_MyStuff where MyField LIKE This worked in Access...????? Thanks Graeme |
Glen Meredit
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Tquery and runtime parametersYou might have alreay done this, but did you declare the parameter type and data type of your param from the Params property of the Object Inspector? If you are creating your Query dynamically, you will need to do a CreateParam. Here is code for that - It is for a TStoredProc though - s/b the same for TQuery.:: Params.CreateParam(ftInteger, '@check_num', ptInput); Help? -Glen QuoteGraeme Cox wrote: |
Loi Tha
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Tquery and runtime parametersIf your query is a live query, the fieldname and/or tablename is case sensitive. Be sure to have the matched exactly with the definition, or You will receive the same error. Loi. QuoteGraeme Cox wrote in message <364B7EAF.699B9...@innovonics.com.au>... |
Russell L. Smit
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Tquery and runtime parametersIf ParamCheck is True (the default), then using CreateParam is unnecessary. When the SQL is changed, the VCL will automatically create the necessary params. I think Graeme's real problem is that the LIKE operator is typically used with some sort of wildcards. For example, the following code fragment will dynamically create a TQuery against an Oracle database and query all personnel rows that start with "S". In Oracle, the "%" wildcard is like a "*". I don't know whether SQL Server uses wildcards, but it seems likely. with TQuery.Create(Self) do Note that I didn't even programmatically type the parameter by setting V/R QuoteGlen Meredith wrote in message <364C31FE.14509...@landasystems.com>... |
Graeme Co
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:Tquery and runtime parametersI know how to set up the parameters, (very positve I am doing it right). The problem is that I cannot pass a string as a parameter without passed as a parameter). It does it if I set it up dynamically or not Has anybody else had this problem with Sql Sever 6.5.. Delphi 4... Graeme |
1. adding a TQuery parameter add runtime
2. How to pass parameter to TQuery and retrieve value from TQuery
3. Obtaining NextVal from Oracle via Delphi TQuery and parameters
4. Adding parameters to a TQuery component?
5. Q : TQuery and SQL and IN and Parameters ?
6. ODBC: How to avoid parameter substitution in TQuery?
8. TQuery and "Invalid Parameter"