sorting DAO recordsets
Audrey Mayes -- audrey.mayes@bbsrc.ac.uk
Friday, January 31, 1997
Environment: MSVC 4.2b, Win95
I am opening a DAOdatabase which has several index fields defined on it. I need
to use a dynamically bound recordset with the fields coming from more than one
table. I am unable to sort the records according to any of the index fields. I
have tried several methods
1. Defining a query in Access and using this query to open the recordset. The
query works in Access but not in Visual C++.
2. Using an SQL statement including an ORDER BY clause.
3. Setting m_strFilter before calling Open() and before calling Requery().
The records are always ordered on the primary key.
Has anyone any ideas as to how I can sort the records.
Audrey Mayes
Mike Blaszczak -- mikeblas@nwlink.com
Sunday, February 02, 1997
At 16:50 1/31/97 +0000, Audrey Mayes wrote:
>Environment: MSVC 4.2b, Win95
>I am opening a DAOdatabase which has several index fields defined on it.
This just doesn't make any sense: indexes are attached to tables,
not to databases.
.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.
This performance was not lip-synched.
Kevin Tarn -- kevin@pln.com.tw
Monday, February 03, 1997
>>3. Setting m_strFilter before calling Open() and before calling Requery().
I think that you should put fields in the ORDER BY clause to m_strSort, and set m_strFilter and m_strSort before calling Open and Requery.
Hope it helpful.
Kevin Tarn
POWER-LINE International Inc.
-----Original Message-----
From: Audrey Mayes [SMTP:audrey.mayes@bbsrc.ac.uk]
Sent: Saturday, February 01, 1997 12:51 AM
To: mfc-l@netcom.com
Subject: sorting DAO recordsets
Environment: MSVC 4.2b, Win95
I am opening a DAOdatabase which has several index fields defined on it. I need
to use a dynamically bound recordset with the fields coming from more than one
table. I am unable to sort the records according to any of the index fields. I
have tried several methods
1. Defining a query in Access and using this query to open the recordset. The
query works in Access but not in Visual C++.
2. Using an SQL statement including an ORDER BY clause.
3. Setting m_strFilter before calling Open() and before calling Requery().
The records are always ordered on the primary key.
Has anyone any ideas as to how I can sort the records.
Audrey Mayes
Audrey Mayes -- audrey.mayes@bbsrc.ac.uk
Monday, February 03, 1997
> >>3. Setting m_strFilter before calling Open() and before calling Requery().
> I think that you should put fields in the ORDER BY clause to m_strSort, and
set m_strFilter and m_strSort before calling Open and Requery.
>
> Hope it helpful.
>
>
> Kevin Tarn
> POWER-LINE International Inc.
I made a mistake in my first posting. When I set m_strFilter or use a WHERE
clause, I get a subset of the entries in the database. It is only with the
m_strSort and the ORDER BY functions that I have a problem.
Audrey Mayes
> -----Original Message-----
> From: Audrey Mayes [SMTP:audrey.mayes@bbsrc.ac.uk]
> Sent: Saturday, February 01, 1997 12:51 AM
> To: mfc-l@netcom.com
> Subject: sorting DAO recordsets
>
> Environment: MSVC 4.2b, Win95
>
> I am opening a DAOdatabase which has several index fields defined on it. I
need
> to use a dynamically bound recordset with the fields coming from more than
one
> table. I am unable to sort the records according to any of the index fields.
I
> have tried several methods
> 1. Defining a query in Access and using this query to open the recordset. The
> query works in Access but not in Visual C++.
> 2. Using an SQL statement including an ORDER BY clause.
> 3. Setting m_strFilter before calling Open() and before calling Requery().
> The records are always ordered on the primary key.
>
> Has anyone any ideas as to how I can sort the records.
>
> Audrey Mayes
>
Simon Young -- young_simon@jpmorgan.com
Tuesday, February 04, 1997
This was unnecessarily pedantic - I think we all know what was meant.
Indices in relational databases may be defined for specific columns on tables -
hence 'index field'.
Simon
To: mfc-l @ netcom.com @ SMTP
cc:
From: mikeblas @ nwlink.com (Mike Blaszczak) @ SMTP
Sent: Sun 02/02/97 05:57:04 PM EST
Subject: Re: sorting DAO recordsets
At 16:50 1/31/97 +0000, Audrey Mayes wrote:
>Environment: MSVC 4.2b, Win95
>I am opening a DAOdatabase which has several index fields defined on it.
This just doesn't make any sense: indexes are attached to tables,
not to databases.
.B ekiM
http://www.nwlink.com/~mikeblas/
These words are my own. I do not speak on behalf of Microsoft.
This performance was not lip-synched.
| Вернуться в корень Архива
|