mikeloria

Using Milliseconds in PI OLEDB Provider

Discussion created by mikeloria on Feb 22, 2012
Latest reply on Feb 27, 2012 by spilon
Branched to a new discussion

 

 

Please help:

 

I am having an issue to run a query against PI OLEDB Provider in C# .net 4.0. I narrowed it down to the milliseconds in my where clause that I really want to use. Below Is my connection string and my sql statement. The first sql fails and the second one works. The only difference is that I removed the millisecond reference from the second. I took these timestamps from return values from PI so I am hoping they will work. See my note below about the Current Time precision which I tried with and with out

 

 

 

/ /I added the current time precision which makes no difference to the sql statement working or not

 

"Provider=PIOLEDB; Data Source=MyPIServer; UserId=mypassword; Password=;Current Time Precision=-1";

 

 

 

//This fails!!!!!   notice the timestamp has the milliseconds

 

"select r.tag, r.time, r.value

 

from piarchive..pirange r

 

where r.tag = 'myPIPoint'

 

AND r.time between '2012-02-22 03:56:13.713' AND '2012-02-22 04:00:44.411'"

 

 

 

//This works!!!!!   without the milliseconds on the timestamps

 

"select r.tag, r.time, r.value

 

from piarchive..pirange r

 

where r.tag = 'myPIPoint'

 

AND r.time between '2012-02-22 03:56:13' AND '2012-02-22 04:00:44'"

Outcomes