I have declared following structure to save data retrieved from access db by getfieldvalue: the error was at Spds_old->Time_old.push_back(OldTime); In the DB the value is 3:00:00 PM. Can you please let me know the error. Thank You. Please let me know if you need more info. Thank You -Kiran
typedef struct {
std::vector<CString> pname_old;
std::vector<CDBVariant> Date_old;
std::vector<CDBVariant> Time_old;
} Spd_old;
Spd_old *Spds_old;
Then in the cpp file this is the code
CRecordset rset(&pdatabase);
CString pName;
CDBVariant OldDate;
CDBVariant OldTime;
CString selectionStr = "SELECT I.PType,I.Date,I.Time FROM CCYX I,(select PType, MAX(Date) AS Date1";
selectionStr += " FROM CCYX GROUP BY PType) T WHERE I.PType = T.PType AND I.Date =T.Date1";
try
{
if(rset.Open(CRecordset::forwardOnly, selectionStr))
{
try
{
while(!(rset.IsBOF()&&rset.IsEOF()))
{
m_Log->Log("Copying Previous spd Values from Access DB");
rset.GetFieldValue((short)0 ,pName );
rset.GetFieldValue((short)1 ,OldDate );
rset.GetFieldValue((short)2 ,OldTime);
Spds_old->pname_old.push_back(pName);
Spds_old->Date_old.push_back(OldDate);
Spds_old->Time_old.push_back(OldTime);