Solved

Help with CDaoRecordset::m_strSort !!!!

Posted on 1999-01-05
2
570 Views
Last Modified: 2013-11-20
I need to know how I use the CDaoRecordset::m_strSort member...... My MFC help its not working!!!! (MSDN)
How I my options ??? alphabetical order??, what else ????
after I set m_strSort what should I do??? call Requery???
thanks in advance!!!
0
Comment
Question by:matias103098
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
plaroche earned 50 total points
ID: 1327224
Here's a doc excerpt that explains it very clearly. If you need more details just ask.


To specify a sort order for a recordset object

Construct a new recordset object (or prepare to call Requery for an existing one).


Set the value of the object’s m_strSort data member.
The sort is a null-terminated string. It contains the contents of the ORDER BY clause but not the keyword ORDER BY. For example, use:

recordset.m_strSort = "LastName DESC, FirstName DESC";

not

recordset.m_strSort = "ORDER BY LastName DESC, FirstName DESC";

Set any other options you need, such as a filter, locking mode, or parameters.


Call Open for the new object (or Requery for an existing object).
The selected records are ordered as specified. For example, to sort a set of student records in descending order by last name, then first name, do the following:

// Construct the recordset
CStudentSet rsStudent( NULL );
// Set the sort
rsStudent.m_strSort = "LastName DESC, FirstName DESC";
// Run the query with the sort in place
rsStudent.Open( );

The recordset contains all of the student records, sorted in descending order (Z to A) by last name, then by first name.


0
 

Author Comment

by:matias103098
ID: 1327225
thanks!!! your help was very usefull!!!! :)
but please, you show me the DESC keyword.... I figure that exist ASC too....
but... exisist other keywords????
thanks in advance
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CRON statement to run every 3 minutes except on Monday morning 12am to 2am 7 123
How to know only "File created" with EventLog 3 35
MaxSpan challenge 9 140
changeXy challenge 13 98
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question