none
Sybase LINQ filtering by Year and Month RRS feed

  • Question

  • I have one query which read all different years / months from the DB which will be used after for querying the DB in parallel as following:


    var splitQuery = (from pv in dbLinq.Table group pv by new {

    pv.Date.Year,

    pv.Date.Month

                                       } into dates                   select dates.Key)

    .ToList(); splitQuery.AsParallel().ForAll(pvChunks =>{     var query = (from pv in dbLinq.Table where (pv.Date.Year == pvChunks.Year && pv.Date.Month == pvChunks.Month) select pv) .ToList(); });

    In the second query I'm getting the following error: Sybase.Data.AseClient.AseException: 'Internal Error'

    • Edited by FcabralJ Thursday, February 13, 2020 10:24 AM
    Thursday, February 13, 2020 9:59 AM

Answers

  • Did you investigate the situation trying simplified non-parallel queries? Such as:

    var test = (from pv in  dbLinq.PricesViews                

                       where pv.Date.Year == 2020 && pv.Date.Month == 2

                       select pv)

                       .ToList();

    • Marked as answer by FcabralJ Friday, February 14, 2020 5:32 AM
    Thursday, February 13, 2020 10:20 AM

All replies

  • Did you investigate the situation trying simplified non-parallel queries? Such as:

    var test = (from pv in  dbLinq.PricesViews                

                       where pv.Date.Year == 2020 && pv.Date.Month == 2

                       select pv)

                       .ToList();

    • Marked as answer by FcabralJ Friday, February 14, 2020 5:32 AM
    Thursday, February 13, 2020 10:20 AM
  • Hi Fcabralj,

    The current message is not enough to let us know what happened.

    Internal Error has many possibilities. Generally, it will be followed by an exception code and some descriptive text, like this:

    Internal Error :30016 Unknown Dataitem Dataitem
    
    Stack Trace - 
    
       at Sybase.Data.AseClient.AseDataReader.CheckResult(Int32 res)
       at Sybase.Data.AseClient.AseDataReader.RetrieveNextResult()
       at Sybase.Data.AseClient.AseDataReader.GetNextResult()
       at Sybase.Data.AseClient.AseDataReader.NextResult()
       at Sybase.Data.AseClient.AseDataReader.CloseUrsHandle()
       at Sybase.Data.AseClient.AseDataReader.Close()
       at Sybase.Data.AseClient.AseDataReader.Dispose(Boolean disposing)
       at Sybase.Data.AseClient.AseDataReader.Dispose()
       at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
       at HSBC.STPMapper.SybaseDAL.Utilities.SybaseHelper.ExecuteDataset(CommandType commandType, String commandText, DataSet dataset, String table, AseParameter[] commandParameters) in C:\Utilities\SybaseHelper.cs:line 119

    Can you show us these information?

    It will help us find and resolve this issue more quickly.

    Looking forward to your reply.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, February 14, 2020 5:28 AM
  • Thank you both for helping me. Finally I figured out what was happened after isolating it from parallel queries as suggested by Viorel.

    The problem was related to not openning the conection with the DB inside the parallel loop which caused an exception. Now the code is like this:

    lstFilters.AsParallel().ForAll(pvChunks =>                {                    
       int currentCount = Interlocked.Increment(ref
    countFiles);
       using (var dbLinq_2 = NewDBInstance(dbType.ToString()))                 {
        dbLinq_2.CommandTimeout = UniversalVariables.linqTimeOut;
        var query = (from pv in dbLinq_2.Table
        where (pv.Date.Year == pvChunks.Key.Year && pv.Date.Month == pvChunks.Key.Month)                                     select pv);
    
       }
    
    }

    Friday, February 14, 2020 5:37 AM