ODBC, CRecordset & CTime 
Author Message
 ODBC, CRecordset & CTime

I'm having trouble retrieving time fields from an Access database using
ODBC and CRecordset. Every time I retrieve a time, I get the same
result: 7 PM. Dates and other fields are retrieving sucessfully. I
really have no idea why I am always getting the same result. I am
working with a very small test database and there is no time field in
the database set to 7 PM.

This is what I've got in the DoFieldExchange function:
        // Columns
        pFX->SetFieldType(CFieldExchange::outputColumn);
        RFX_Long(pFX, _T("[MeetingID]"), m_meetingID);
        RFX_Date(pFX, _T("[Date]"), m_date);
        RFX_Date(pFX, _T("[EndTime]"), m_endTime);
        RFX_Text(pFX, _T("[Comments]"), m_comments);
        RFX_Text(pFX, _T("[Location]"), m_location);
        RFX_Text(pFX, _T("[Subject]"), m_subject);
        RFX_Text(pFX, _T("[Requester]"), m_requester);
        RFX_Text(pFX, _T("[Status]"), m_status);
        RFX_Date(pFX, _T("[StartTime]"), m_startTime);

        // Parameters
        pFX->SetFieldType(CFieldExchange::param);
        RFX_Text(pFX, "UserIDParam", m_userIDParam);
        RFX_Date(pFX, "DateParam", m_dateParam);

m_endTime and m_startTime are of type CTime.

I access the records from outside the recordset object with the
following code, where myMeetingListSet is an instance of my subclass of
CRecordset:

        myMeetingListSet.m_dateParam = date;

        myMeetingListSet.Open(); // Perform query

        // Package data
        while ( !myMeetingListSet.IsEOF() ) // Loop for all records
        {
                currentMeeting.m_meetingID =
                   myMeetingListSet.m_meetingID;
                currentMeeting.m_date = myMeetingListSet.m_date;
                currentMeeting.m_endTime = myMeetingListSet.m_endTime;
                currentMeeting.m_comments = myMeetingListSet.m_comments;
                currentMeeting.m_location = myMeetingListSet.m_location;
                currentMeeting.m_subject = myMeetingListSet.m_subject;
                currentMeeting.m_requester =
                   myMeetingListSet.m_requester;
                currentMeeting.m_status = myMeetingListSet.m_status;
                currentMeeting.m_startTime =
                   myMeetingListSet.m_startTime;

                // Add meeting to list
                myMeetingList.AddTail(currentMeeting);

                printf("Meeting start time = %s<BR>\n",
                   myMeetingListSet.m_startTime.Format("%I:%M %p"));

                myMeetingListSet.MoveNext(); // Move to next record
        }

The printf statement above is for debugging purposes. I have tried
checking the value of both myMeetingListSet.m_startTime and
currentMeeting.m_startTime. Both give me 7 PM.

Any help would be greatly appreciated.

Thanks in advance,

Mark Ferreira

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Thu, 16 May 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Trouble with CTime from a ODBC CRecordset in VC++

2. CTime & CRecordset class

3. Questions on ODBC & CRecordset

4. CRecordset class & Visual Foxpro ODBC driver

5. CTime in CRecordset

6. CRecordset with CTime

7. Problem with CRecordset and CTime when update

8. Problem with CTIme at CRecordSet update

9. Stuck with CTime in CRecordsets?

10. CTime and CRecordset

11. time zone problem with a CTime member var in CRecordset-derived class

12. Problem with CTime and CRecordset

 

 
Powered by phpBB® Forum Software