PeterJ

Parameterizing queries in  OLEDB-E from .Net

Discussion created by PeterJ on Nov 20, 2013
Latest reply on Nov 22, 2013 by michaelh

I have a parameterised OLEDB-E query which I am excuting using a .Net  OleDbCommand.

 

The query in includes:

 

"..CROSS APPLY AFDB.Data.InterpolateRange (ea.ID, ?, ?, ?) "

 

I want to substitute the values using parameters. I have:

 

 OleDbCommand cmd = new OleDbCommand(query, connection);
           cmd.Parameters.AddWithValue("@start", StartTime);
           cmd.Parameters.AddWithValue("@end",  EndTime ); 
           cmd.Parameters.AddWithValue("@interval", period);  
           OleDbDataReader r = cmd.ExecuteReader();

 

StartTime & EndTime are of type "DateTime, period is of type "TimeSpan"

 

it works fine ! ... until I set the period to 1 day - ( period = new TimeSpan(24, 0, 0);)

 

Then it gives me an error: '[InterpolateRange] Time step must be greater than zero.'

 

How can I set the interval to >=  a day?

Outcomes