Solved

Help with CDaoRecordset::m_strSort !!!!

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
iSeries DB2 Query 2 84
has22 challenge 11 72
matchUp  challenge 9 72
Problem to event 3 52
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now