Solved

Help with CDaoRecordset::m_strSort !!!!

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

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
Turn a spreadsheet into a vba executable. 2 91
Expand macro to ask for filename column 8 37
Whole sheet autoscrub still needed 19 51
while loop over for loop 7 115
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 …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

790 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