Editor.Where()
Editor.Where()
Chandler242
Posts: 36Questions: 12Answers: 0
in Editor
Hello,
Since the first parameter for Editor.Where() is column name, I assume that there isn't way to do a condition that doesn't involve column name but only a constant, such as a function input parameter. Or there is a way other than using .Where()?
Thank you,
John Li
Answers
Hi John,
You can use the result of an SQL function as part of the query by using a function for the condition but the first parameter would still be a column.
Allan
Hey Allan,
I might have misunderstood your response. But what I intended to do is
in
to construct .Where to get the following query condition:
There is no "0" value in the table. By doing above I try to get all the records with "0" value.
I wonder if there is a solution with using .Where() or anything else.
Regards,
John Li
Is how that could be done with our database class. The
false
parameter on the lastWhere
condition just ensures that the value isn't bound - see docs here.Allan
Hello Allan,
I had tried, and tried again this morning. I kept getting DataTables message "Invalid column name 'HwyID' " . I guess the message makes sense because HwyID is not a table column name.
I read the linked doc and .NET API doc several times they all state that the first parameter of .Where() is a table name. I must still be missing something. Could you shed more light on this?
Regards,
John
What is it then? I took it from your line above.
The first parameter for
Where
is the column name, but it can be prefixed by a table name.Allan
Hey Allan,
Sorry for the confusion. "HwyID" is a parameter in method
It is just a parameter, not associated with any specific table column.
Thank you,
John
Oh - sorry! I even copy / pasted it in the controller I showed above!
That makes things much easier then - since it effectively means no query when
HwyID == 0
, so we can apply a condition on it when it is greater than 0:Allan
Hey Allan,
I was so absorbed to .Where() that I didn't even think of 'if'. Thank you for your patience and kindness.
Regards,
Yongqi