This question is locked. New answers and comments are not allowed.
I am attempting to something similar to this:
public
bool
Persist()
{
using
(Model context =
new
Model())
{
IQueryable<Item> rs = (from d
in
context.Data select d);
TotalCount = rs.Count();
if
(TotalCount <= 0)
return
false
;
foreach
(Item r
in
rs)
{
// Additional Code
}
}
}
And after about 10% of the way through the foreach loop, it throws this exception:
Telerik.OpenAccess.Exceptions.DataStoreException: System.InvalidOperationException: Invalid attempt to read when no data is present.
at System.Data.SqlClient.SqlDataReader.ReadColumnHeader(Int32 i)
at System.Data.SqlClient.SqlDataReader.IsDBNull(Int32 i)
at OpenAccessRuntime.Data.BigIntConverter.ToInt32.Read(DataHolder& data)
at OpenAccessRuntime.Relational.metadata.RelationalColumn.GetValue(DataHolder& data)
at OpenAccessRuntime.Relational.RelationalGenericOID.CopyKeyFields(DataHolder& data)
at OpenAccessRuntime.Relational.fetch.FopGetOID.fetch(FetchResult fetchResult, StateContainer stateContainer)
at OpenAccessRuntime.Relational.fetch.FetchSpec.createRow(FetchResult fetchResult, StateContainer stateContainer)
Processing 0: Data [0] System.InvalidOperationException: Invalid attempt to read when no data is present.
at System.Data.SqlClient.SqlDataReader.ReadColumnHeader(Int32 i)
at System.Data.SqlClient.SqlDataReader.IsDBNull(Int32 i)
at OpenAccessRuntime.Data.BigIntConverter.ToInt32.Read(DataHolder& data)
at OpenAccessRuntime.Relational.metadata.RelationalColumn.GetValue(DataHolder& data)
at OpenAccessRuntime.Relational.RelationalGenericOID.CopyKeyFields(DataHolder& data)
at OpenAccessRuntime.Relational.fetch.FopGetOID.fetch(FetchResult fetchResult, StateContainer stateContainer)
at OpenAccessRuntime.Relational.fetch.FetchSpec.createRow(FetchResult fetchResult, StateContainer stateContainer) ---> System.InvalidOperationException: Invalid attempt to read when no data is present.
at System.Data.SqlClient.SqlDataReader.ReadColumnHeader(Int32 i)
at System.Data.SqlClient.SqlDataReader.IsDBNull(Int32 i)
at OpenAccessRuntime.Data.BigIntConverter.ToInt32.Read(DataHolder& data)
at OpenAccessRuntime.Relational.metadata.RelationalColumn.GetValue(DataHolder& data)
at OpenAccessRuntime.Relational.RelationalGenericOID.CopyKeyFields(DataHolder& data)
at OpenAccessRuntime.Relational.fetch.FopGetOID.fetch(FetchResult fetchResult, StateContainer stateContainer)
at OpenAccessRuntime.Relational.fetch.FetchSpec.createRow(FetchResult fetchResult, StateContainer stateContainer)
--- End of inner exception stack trace ---
at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
at Telerik.OpenAccess.RT.ExceptionWrapper.Throw()
at OpenAccessRuntime.storagemanager.logging.LoggingStorageManager.fetchNextQueryResult(ApplicationContext context, RunningQuery runningQuery, Int32 skipAmount)
at OpenAccessRuntime.DataObjects.SynchronizedPMProxy.getNextQueryResult(QueryResultWrapper aQrs, Int32 skipAmount)
at OpenAccessRuntime.DataObjects.ForwardQueryResult.GetMoreDataIntoWindow(Int32 requestedIndex)
at OpenAccessRuntime.DataObjects.ForwardQueryResult.InternalGetSparse(Int32 requestedIndex)
at OpenAccessRuntime.DataObjects.ForwardQueryResult.get_Item(Int32 indexParam)
at OpenAccessRuntime.DataObjects.SynchronizedQueryResult.get_Item(Int32 index)
at Telerik.OpenAccess.RT.ListEnumerator.setCurrent(Int32 _pos)
at Telerik.OpenAccess.RT.ListEnumerator.Move(Int32 relative)
at Telerik.OpenAccess.RT.ListEnumerator.MoveNext()
at Telerik.OpenAccess.Query.TypedEnumerator`1.System.Collections.IEnumerator.MoveNext()
at Data.Persist() in C:\Project\Data.cs:line 194
I did attempt to follow the suggestions from this post, but the changes (editing the timeout in the Model Settings Dialog) didn't fix my problem. For reference, line 194 mentioned in the Stack track is the foreach loop line.
Any help would be greatly appreciated.
Jay