Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i'm trying to select the max of a date of a specific device,but i'm getting the error "the operand is missing after the operator "where".

C#
max=t.GetData().Select("MAX(time) WHERE EQUIPEMENT_REF='mydevice'")[0].ItemArray[1].ToString();


thanks for your help
Posted
Comments
Richard C Bishop 12-Apr-13 14:22pm    
What is "t"?
Member 9870058 12-Apr-13 14:39pm    
nmsdbDataSetTableAdapters.temperatureTableAdapter t = new nmsdbDataSetTableAdapters.temperatureTableAdapter();
Member 9870058 12-Apr-13 14:40pm    
if i remove where equipement_ref=mydevice it works but it shows the max of the date of all the devices
Richard C Bishop 12-Apr-13 14:42pm    
My guess is "mydevice" is the issue. Do you need a dynamic variable there?
Member 9870058 12-Apr-13 14:51pm    
yes,that's the problem,actualy i need the max date of a device identified by its id

1 solution

i solved the problem ,first of all if you need to put more than critere you have to put and between,second for to get the max date for a specfic device i had to sort the result and choose the first one

SQL
max = o.GetData().Select("equipement_ref='mydevice'","time DESC")[0].ItemArray[1].ToString();
               min = o.GetData().Select("equipement_ref='mydevice'", "time ASC")[0].ItemArray[1].ToString();
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900