locked
CRM Linq query cause sql lock with select top 5001 RRS feed

  • Question

  •  I'm using linq to query data, but some times it cause sql lock:

    Language Event    0    (@new_safid0 uniqueidentifier)select
    top 5001 "new_sample_application_details0".new_materialid as "new_materialid"
    , "new_sample_application_details0".new_sample_application_detailsId as "new_sample_application_detailsid"
    , "new_sample_application_details0".new_materialidName as "new_materialidname"
    from
     new_sample_application_details as "new_sample_application_details0"
    where
     (("new_sample_application_details0".new_safid = @new_safid0)) order by
     "new_sample_application_details0".new_sample_application_detailsId asc

    Any suggestion? thanks in advance.


    Awen

    Thursday, November 20, 2014 9:20 AM

All replies

  • Hi Awen,

    If you use Query Expression, then you can give NoLock hint in your query as mentioned below :

    QueryExpression query = new QueryExpression
    {
         NoLock = true,
         EntityName = "account",

    But it will give uncommitted records (dirty read), please check the requirement also before this chnage


    Thanks,

    Sebastian


    Thursday, November 20, 2014 9:42 AM
  • Thanks for your replay.

    Dirty read is not acceptable.


    Awen

    Thursday, November 20, 2014 9:47 AM