Solved

Sorting of a DataBase

Posted on 1998-09-08
2
128 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 40 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

708 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