Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. problem with Open() method

problem with Open() method

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelpcssperformancequestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SWDevil
    wrote on last edited by
    #1

    Hi, I have an application in which I am loading data from a database (in this specific case a large database) into a grid in my GUI. So, I open the query into a recordset using the Open method as follows: sQuery.Format(_T("SELECT DISTINCT D.fieldA, DC.fieldB from TableDC DC, TableD D WHERE D.fieldA = DC.fieldA AND D.No = '3’ ORDER BY DC.fieldB")); if(!Open(AFX_DB_USE_DEFAULT_TYPE, sQuery, CRecordset::readOnly)) { ... } The problem is that the statement that contains the call to the Open method sometimes takes about 2 minutes to execute (and sometimes works ok). Anyone have any idea of why this happens? And maybe an idea of how I can fix it (speed it up)?

    L 1 Reply Last reply
    0
    • S SWDevil

      Hi, I have an application in which I am loading data from a database (in this specific case a large database) into a grid in my GUI. So, I open the query into a recordset using the Open method as follows: sQuery.Format(_T("SELECT DISTINCT D.fieldA, DC.fieldB from TableDC DC, TableD D WHERE D.fieldA = DC.fieldA AND D.No = '3’ ORDER BY DC.fieldB")); if(!Open(AFX_DB_USE_DEFAULT_TYPE, sQuery, CRecordset::readOnly)) { ... } The problem is that the statement that contains the call to the Open method sometimes takes about 2 minutes to execute (and sometimes works ok). Anyone have any idea of why this happens? And maybe an idea of how I can fix it (speed it up)?

      L Offline
      L Offline
      Laxman Auti
      wrote on last edited by
      #2

      SWDevil wrote:

      The problem is that the statement that contains the call to the Open method sometimes takes about 2 minutes to execute (and sometimes works ok). Anyone have any idea of why this happens? And maybe an idea of how I can fix it (speed it up)?

      This may due to your DataBase doing some pending work..or your request is not scheduled by the Database engine..as well as its a ORDER query so it takes time to fetch the fields and sorting as well. Knock out 't' from can't, You can if you think you can :cool:

      S 1 Reply Last reply
      0
      • L Laxman Auti

        SWDevil wrote:

        The problem is that the statement that contains the call to the Open method sometimes takes about 2 minutes to execute (and sometimes works ok). Anyone have any idea of why this happens? And maybe an idea of how I can fix it (speed it up)?

        This may due to your DataBase doing some pending work..or your request is not scheduled by the Database engine..as well as its a ORDER query so it takes time to fetch the fields and sorting as well. Knock out 't' from can't, You can if you think you can :cool:

        S Offline
        S Offline
        SWDevil
        wrote on last edited by
        #3

        A_LaxmanThis may due to your DataBase doing some pending work..or your request is not scheduled by the Database engine..

        can I somehow check if this happens and if it does, can I fix it?

        A_Laxmanas well as its a ORDER query so it takes time to fetch the fields and sorting as well.

        but this same query sometimes executes very quickly...

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups