ODBC and CRecordSet Sort Question 
Author Message
 ODBC and CRecordSet Sort Question

Visual C++ 4.2
Windows 95
Access 2.0

I created a CRecordSet class via the Class Wizard, pointing to a single
table in a Access 2.0 MDB file.
(The MDB file was registered using the "Control Panel" "ODBC Manager")

In my CMainframe header file I create a pointer to the CRecordSet derived
class.

In my CMainframe Constructor I create a "new" pointer to the object.
In my CMainframe Constructor I set the "strSort" to the value of the field I
whish to sort on.

Later on, after a specific menu selection. I "Open" the CRecordSet object,
then call "Addnew()", add the field values that I want to, call "Update()".
After several records have been added this way I finally "Close()" the
object.

When I exit the application and view the table using Microsoft Access 2.0,
the table is sorted according to the key field and not the field I
specified.

What gives?

Any comments/suggestions gratefully accepted.



Mon, 03 Jul 2000 03:00:00 GMT  
 ODBC and CRecordSet Sort Question

Access sorts the DB differently to the way your app sorts it. You need
to check the DB in your app to see the way it has been sorted there.

Guido

Quote:

> Visual C++ 4.2
> Windows 95
> Access 2.0

> I created a CRecordSet class via the Class Wizard, pointing to a single
> table in a Access 2.0 MDB file.
> (The MDB file was registered using the "Control Panel" "ODBC Manager")

> In my CMainframe header file I create a pointer to the CRecordSet derived
> class.

> In my CMainframe Constructor I create a "new" pointer to the object.
> In my CMainframe Constructor I set the "strSort" to the value of the field I
> whish to sort on.

> Later on, after a specific menu selection. I "Open" the CRecordSet object,
> then call "Addnew()", add the field values that I want to, call "Update()".
> After several records have been added this way I finally "Close()" the
> object.

> When I exit the application and view the table using Microsoft Access 2.0,
> the table is sorted according to the key field and not the field I
> specified.

> What gives?

> Any comments/suggestions gratefully accepted.



Mon, 03 Jul 2000 03:00:00 GMT  
 ODBC and CRecordSet Sort Question


Quote:
>Visual C++ 4.2
>Windows 95
>Access 2.0

>I created a CRecordSet class via the Class Wizard, pointing to a single
>table in a Access 2.0 MDB file.
>(The MDB file was registered using the "Control Panel" "ODBC Manager")

>In my CMainframe header file I create a pointer to the CRecordSet derived
>class.

>In my CMainframe Constructor I create a "new" pointer to the object.
>In my CMainframe Constructor I set the "strSort" to the value of the field
I
>whish to sort on.

>Later on, after a specific menu selection. I "Open" the CRecordSet object,
>then call "Addnew()", add the field values that I want to, call "Update()".
>After several records have been added this way I finally "Close()" the
>object.

>When I exit the application and view the table using Microsoft Access 2.0,
>the table is sorted according to the key field and not the field I
>specified.

>What gives?

>Any comments/suggestions gratefully accepted.

Setting the m_strSort field in CRecordset is equivalent to right-clicking a
field header in an Access datasheet view and selecting "Sort Acsending" or
"Sort Descending" from the popup menu.

    -Dave.



Mon, 03 Jul 2000 03:00:00 GMT  
 ODBC and CRecordSet Sort Question

Sorting in Access is controlled by index table.   Sorting in CRecordset is
only for when your application retrieves data from the database.   They are
totally different from each other.

Peter N.
Sr. Software Engineer
MITEK Systems, Inc.



Quote:
> Visual C++ 4.2
> Windows 95
> Access 2.0

> I created a CRecordSet class via the Class Wizard, pointing to a single
> table in a Access 2.0 MDB file.
> (The MDB file was registered using the "Control Panel" "ODBC Manager")

> In my CMainframe header file I create a pointer to the CRecordSet derived
> class.

> In my CMainframe Constructor I create a "new" pointer to the object.
> In my CMainframe Constructor I set the "strSort" to the value of the
field I
> whish to sort on.

> Later on, after a specific menu selection. I "Open" the CRecordSet
object,
> then call "Addnew()", add the field values that I want to, call
"Update()".
> After several records have been added this way I finally "Close()" the
> object.

> When I exit the application and view the table using Microsoft Access
2.0,
> the table is sorted according to the key field and not the field I
> specified.

> What gives?

> Any comments/suggestions gratefully accepted.



Mon, 03 Jul 2000 03:00:00 GMT  
 ODBC and CRecordSet Sort Question

On Thu, 15 Jan 1998 15:53:43 +0200, "Garth Tolmie"

Quote:

>Visual C++ 4.2
>Windows 95
>Access 2.0

>I created a CRecordSet class via the Class Wizard, pointing to a single
>table in a Access 2.0 MDB file.
>(The MDB file was registered using the "Control Panel" "ODBC Manager")

>In my CMainframe header file I create a pointer to the CRecordSet derived
>class.

>In my CMainframe Constructor I create a "new" pointer to the object.
>In my CMainframe Constructor I set the "strSort" to the value of the field I
>whish to sort on.

>Later on, after a specific menu selection. I "Open" the CRecordSet object,
>then call "Addnew()", add the field values that I want to, call "Update()".
>After several records have been added this way I finally "Close()" the
>object.

>When I exit the application and view the table using Microsoft Access 2.0,
>the table is sorted according to the key field and not the field I
>specified.

>What gives?

>Any comments/suggestions gratefully accepted.

m_strSort affects only the recordset itself -- it affects the order in
which you'll get the rows when using MoveNext().

Don Grasberger
(remove --- from address to e-mail)



Mon, 03 Jul 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. CDaoRecordset/CRecordset/ODBC Question

2. Questions on ODBC & CRecordset

3. ODBC CRecordset m_strFilter CString question

4. ODBC, CRecordSet - question

5. Field data truncated using a sorted CRecordset

6. CRecordset and sorting?

7. EXCEL ODBC: Can CRecordSet Update spreadsheet?

8. CRecordset for ODBC 3.0

9. CRecordset/CDatabase broken by ODBC 3.5?

10. Using CRecordSet for ODBC joins

11. Oracle ODBC Drivers that support CRecordset::dynaset

12. Error updating SQL-Server record via ODBC (CRecordset)

 

 
Powered by phpBB® Forum Software