Solved

Help with CDaoRecordset::m_strSort !!!!

Posted on 1999-01-05
2
582 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

624 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