Since I've updated to the new version of toa, I get the following DataStoreException...
I have the following code:
string oql = @"MAX(SELECT m_ActionDate FROM ActivityExtent AS a WHERE a.m_Contact != nil AND a.m_Contact.m_Id = $1 AND a.m_ActionDate >= $2)" |
object[] param = new object[2]; |
param [0] = Guid.NewGuid(); |
param [1] = SqlDateTime.MinValue.Value; |
IQuery query = this.ObjectScope.GetOqlQuery(oql); |
query.MaxResultCount = 1; |
if (param != null) |
{ |
using (IQueryResult result = query.Execute(param)) |
{ |
if (result.Count == 0) |
Whenever I'm on result.Count I get the following exception:
Telerik.OpenAccess.Exceptions.DataStoreException was unhandled
Message="Error executing query: Telerik.OpenAccess.RT.sql.SQLException: Must declare the scalar variable \"@__TAKE\".\r\nStatement(s) could not be prepared.\r\n at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()\r\n at OpenAccessRuntime.jdbc.conn.PooledPSWithParamLogging.executeQuery()\r\n at OpenAccessRuntime.jdbc.fetch.FetchResultImp.execute()\nSQL:\nSELECT TOP(??T) MAX(a.[ActionDate]) FROM [tbl_Activity] a JOIN [tbl_Contact] AS b ON (a.[Contact_tbl_Contact_Id] = b.[Id]) WHERE a.[Contact_tbl_Contact_Id] is not null AND b.[Id] = ? AND a.[ActionDate] >= ? Telerik.OpenAccess.RT.sql.SQLException: Must declare the scalar variable \"@__TAKE\".\r\nStatement(s) could not be prepared.\r\n at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()\r\n at OpenAccessRuntime.jdbc.conn.PooledPSWithParamLogging.executeQuery()\r\n at OpenAccessRuntime.jdbc.fetch.FetchResultImp.execute()"
Source="Telerik.OpenAccess"
CanRetry=false
StackTrace:
at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
at Telerik.OpenAccess.RT.ExceptionWrapper.Throw()
at OpenAccessRuntime.storagemanager.logging.LoggingStorageManager.executeQueryAll(ApplicationContext context, ImmutableQueryDetails query, CompiledQuery compiledQuery, Object[] para, Int32 skip, Int32 take)
at OpenAccessRuntime.jdo.SynchronizedPMProxy.getAllQueryResults(CompiledQuery cq, Object[] para, Int32 skip, Int32 take)
at OpenAccessRuntime.jdo.VersantQueryImp.executeWithArrayImp(Object[] parameters)
at OpenAccessRuntime.jdo.VersantQueryImp.executeWithArray(Object[] parameters)
at Telerik.OpenAccess.RT.QueryResultImpl.check()
at Telerik.OpenAccess.RT.ListEnumerator.get_Count()
InnerException: Telerik.OpenAccess.RT.sql.SQLException
Message="Must declare the scalar variable \"@__TAKE\".\r\nStatement(s) could not be prepared."
Source="Telerik.OpenAccess.Adonet2"
Description="SQLState=;Must declare the scalar variable \"@__TAKE\".\r\nStatement(s) could not be prepared."
ErrorCode=137
Number=137
StackTrace:
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery()
at OpenAccessRuntime.jdbc.conn.PooledPSWithParamLogging.executeQuery()
at OpenAccessRuntime.jdbc.fetch.FetchResultImp.execute()
InnerException:
{"Must declare the scalar variable \"@__TAKE\".\r\nStatement(s) could not be prepared."}
thx for your help
Boris