|
| [WD20] [HFSQL20] Passing parameter |
| Iniciado por guest, 27,ago. 2016 12:39 - 11 respuestas |
| |
| | | |
|
| |
| Publicado el 27,agosto 2016 - 12:39 |
Hello,
How to pass a set of parameter to query which is filtered with 'in..'
Select * From [TableName] Where [ColumnName] in [(param1)]
I need to pass value to this param1 from windev. Usually I assign values like this
query.param1 = 'A'
Couldn't find out how to pass array of values.
Happiness Always BKR Sivaprakash |
| |
| |
| | | |
|
| | |
| |
| Publicado el 27,agosto 2016 - 13:22 |
Hi
from the top of my head, it's something like: Query.paramIN = "A;B;C"
Best regards |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,agosto 2016 - 15:56 |
Hello,
Trying to display the query result in a table. Query is
Select * From [TableName] Where [ColumnName] in [(param1)]
// Query usage table1.browsedfile = "" qry.param1 = "A;B;C" HExecuteQuery(qry, hquerydefault) table1.browsedfile = qry
I get the error: Error at line xxx of click btn_x process, the file or view or query, 'qry' is unknown.
If I remove the param1 assignment, the query executes perfectly, but I get all the values from the file. Tried all known ways (to me), get qry is unknown error only.
Any suggestions ?
Happiness Always BKR Sivaprakash |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,agosto 2016 - 16:00 |
Have you tried
table1.browsedfile = "qry"
with quotes around? |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,agosto 2016 - 16:03 |
| Sorry, I missed to quote here. But in my code, it's there. |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,agosto 2016 - 16:14 |
Hi Sivaprakash,
What is the name of your actual query? Is it a query you made with the query editor or is it a query you made in a string?
This will totally change how you must pass the parameters. If you made it in the query editor, use the same name. I'm quite sure it is not "qry".
Show us your full source code if needed so that we can help you better.
Best regards, Alexandre Leclerc |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,agosto 2016 - 16:14 |
Hi
the firts thing would be to test the return of hexecutequery AND to display the detailed error
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM (open source)
More information on http://www.fabriceharari.com
Le 8/29/2016 à 7:56 AM, Sivaprakash a écrit :
Hello,
Trying to display the query result in a table. Query is
Select * From [TableName] Where [ColumnName] in [(param1)]
// Query usage table1.browsedfile = "" qry.param1 = "A;B;C" HExecuteQuery(qry, hquerydefault) table1.browsedfile = qry
I get the error: Error at line xxx of click btn_x process, the file or view or query, 'qry' is unknown.
If I remove the param1 assignment, the query executes perfectly, but I get all the values from the file. Tried all known ways (to me), get qry is unknown error only.
Any suggestions ?
Happiness Always BKR Sivaprakash |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,agosto 2016 - 16:18 |
Hello,
I believe you will have to build the query parameter list by separating each value by comma (,) and not semi colons.
Try to build the list of IDs that you want like this: 1,2,4,5,7,89,909,...
Now assign this string to the Parameter and it should work!
HTH
Yogi Yang |
| |
| |
| | | |
|
| | |
| |
| Publicado el 29,agosto 2016 - 16:29 |
Hi Yogi,
In fact it depends of the type and how you pass the parameters. Except I'm mistaken, it goes as follow:
If this is a string query, you must use comas as in your example: - IN (1,2,3) - IN ('a','b','c')
If this is a query from the editor, you use semi-colons: - qry.Param1 = "1;2;3" - qry.Param1 = "'a';'b';'c'"
Best regards, Alexandre Leclerc |
| |
| |
| | | |
|
| | |
| |
| Publicado el 30,agosto 2016 - 08:48 |
Thanks Alexandre Leclerc, Yogi Yang.
Now this works fine. It's my mistake, in assigning the values. The way mentioned by Fabrice Harari is working fine.
Thanks again.
Happiness Always BKR Sivaprakash |
| |
| |
| | | |
|
| | |
| |
| Publicado el 30,agosto 2016 - 11:50 |
Haven't read the thread completely, but this should do the trick:
MyQuery.MyInListParameter = Arraystostring(YourStringArrayVariable,";")
Cheers,
Peter Holemans |
| |
| |
| | | |
|
| | |
| |
| Publicado el 30,agosto 2016 - 12:28 |
| Thanks Peter Holemans, it's working now. |
| |
| |
| | | |
|
| | | | |
| | |
|