Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sorting of a DataBase

Posted on 1998-09-08
2
Medium Priority
?
137 Views
Last Modified: 2013-11-20
Hi,

I have built a database from VB5.0.
Now, I try to do the sorting of the data of the database
by using the function -- CDaoRecordset::m_strSort

The remarks of this topic mentioned that:
Contains a string containing the ORDER BY clause of an SQL statement without the reserved words ORDER BY. You can sort on dynaset- and snapshot-type recordset objects.

Now I have a dynaset recordset objects. How can
I sort the specified column of my Database by the above
function or any other good method to implement this?

The fields of my database are as follows:

Direct Number, Extension Number, First Name, Last Name
I want to do the sorting for the direct number.
Thanks!!!
0
Comment
Question by:ee_lcpaa
  • 2
2 Comments
 
LVL 7

Accepted Solution

by:
psdavis earned 120 total points
ID: 1321903
You've basically got it.  In your CDaoRecordset, your m_strSort will look something like this (just guessing about your code)

CNameRecordset* pSet = ... (however you do it)
pSet->m_strSort = "[First Name]"
pSet->Requery( );

That should be it.  Good luck.

Phillip
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1321904
p.s.

For your specific answer.

pSet->m_strSort = "[Direct Number]";
pSet->Open( ... );

If this is your first time to open the recordset, you can do this right before the 'Open' and you can skip the Requery.  Otherwise, you can do it dynamically the way I showed you the first time.

Phillip
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift 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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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 video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

885 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