Hi all,
I am facing a problem for my program. Basically I intend to update my database each time an event occurs. However I want to eliminate redundant records as in if a particular identity is already in my record for today, it must not appear again. Ut is ok if it appears tomorrow since the date will be changed by then. However my following code generates error. Not sure if my filter string is the one at fault or the GetRecordCount() function to detect the presence of the ID for that day is errorneous. Here is teh code:
m_pCapturedResults->m_strFilter = "Date = '" + changedate + "' AND Serial Number = '" + sSnr +"'";
if(m_pCapturedResults->GetRecordCount() == 0)
{
AfxMessageBox("Start Time Recorded", MB_ICONINFORMATION);
m_pCapturedResults->m_Protocol_Type = sTagType;
m_pCapturedResults->m_Time_Started = changetime;
m_pCapturedResults->m_Date = changedate;
m_pCapturedResults->m_Serial_Number = sSnr;
m_pCapturedResults->Update(); // Update Database
}
if(m_pCapturedResults->GetRecordCount() == 1)
{
AfxMessageBox("End Time Recorded.", MB_ICONINFORMATION);
m_pCapturedResults->m_Time = changetime;
m_pCapturedResults->Update(); // Update Database
}
If the recordcount is 1, the record is supposed to find the entry wif the same sSnr and update the columns. But it seems like my code does not eliminate the redundancy problem and it seems that it may not even have entered either of the if loop even though I do not have any records which meet the filter. Please advice......Thanks
I am facing a problem for my program. Basically I intend to update my database each time an event occurs. However I want to eliminate redundant records as in if a particular identity is already in my record for today, it must not appear again. Ut is ok if it appears tomorrow since the date will be changed by then. However my following code generates error. Not sure if my filter string is the one at fault or the GetRecordCount() function to detect the presence of the ID for that day is errorneous. Here is teh code:
m_pCapturedResults->m_strFilter = "Date = '" + changedate + "' AND Serial Number = '" + sSnr +"'";
if(m_pCapturedResults->GetRecordCount() == 0)
{
AfxMessageBox("Start Time Recorded", MB_ICONINFORMATION);
m_pCapturedResults->m_Protocol_Type = sTagType;
m_pCapturedResults->m_Time_Started = changetime;
m_pCapturedResults->m_Date = changedate;
m_pCapturedResults->m_Serial_Number = sSnr;
m_pCapturedResults->Update(); // Update Database
}
if(m_pCapturedResults->GetRecordCount() == 1)
{
AfxMessageBox("End Time Recorded.", MB_ICONINFORMATION);
m_pCapturedResults->m_Time = changetime;
m_pCapturedResults->Update(); // Update Database
}
If the recordcount is 1, the record is supposed to find the entry wif the same sSnr and update the columns. But it seems like my code does not eliminate the redundancy problem and it seems that it may not even have entered either of the if loop even though I do not have any records which meet the filter. Please advice......Thanks