Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6655055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:27:59+00:00 2026-05-26T01:27:59+00:00

I am using c++ with ADO to connect to a mySql database, and I

  • 0

I am using c++ with ADO to connect to a mySql database, and I am using the standard ADO/C++ method to create a connection to the mySql database, and recordset is the pointer to the retrieved first record

_RecordsetPtr recordset;
recordset->Open("Select * from table",p_connection_.GetInterfacePtr(),adOpenForwardOnly,adLockReadOnly,adCmdText);  

My concern is if the table contains too many records, and if I query all records, it will consume alot of memory?

I want to only retrieve, maybe 100 records each time and process them. Is it possible? The table does not contain id or index as its attribute, so “Select * from table where id >= 1 and id <= 100” does not work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:27:59+00:00Added an answer on May 26, 2026 at 1:27 am

    You will want to use limits on the query and cycle through them.

    //SELECT * FROM table LIMIT 0 OFFSET 100
    
    int tlimit, blimit;
    std::string query;
    std::stringstream sstm;
    _RecordsetPtr recordset, count;
    
    count->Open("SELECT COUNT(*) FROM table",p_connection_.GetInterfacePtr(),adOpenForwardOnly,adLockReadOnly,adCmdText);
    
    for(int i = 0; i < count/100 + 1; i++)
    {
       tlimit = 100 * i + 100;
       blimit = 100 * i;
    
       sstm << "SELECT * FROM table LIMIT " << blimit << " OFFSET " << tlimit;
       query = sstm.str();
    
       recordset->Open(query,p_connection_.GetInterfacePtr(),adOpenForwardOnly,adLockReadOnly,adCmdText);
    
       //suggest passing the recordset to a function to do what ever you want with it here
    }
    

    Note that if you are not using a database that starts its records off at 1 you will have to modify that algorithm a bit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

long-time listener, first-time caller! I’m trying to connect to MySQL using the ADO.NET Entity
I'm using ADO-components to connect to an access database. In a column defined as
Can I connect to a Ubuntu server, that is running MySQL using ADO.NET or
I've got a vb.net codebase using ado to connect to an Oracle database. We
I'm developing an ASP.NET app (C#) that connect to SQL Server 2008 using ADO.NET
I'm using ADO to save data to an MS Access database. It was taking
I have a ASP.Net page using ADO to query MS access database and as
I am using ADO.Net + C# + VSTS 2008 + ADO.Net to connect to
I have a C# application, using ADO.Net to connect to MSSQL I need to
In Short: I'm using VB.NET 2008 to connect to a Visual Foxpro 6 Database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.