Okay Here is the Visual C++ Code:
strQuery = "SELECT * FROM Employee WHERE Name= '"+aQue.m_provfname+" "+aQue.m_provlname+"'"; aEmp.Open(CRecordset::snapshot,strQuery,CRecordset::skipDeletedRecords);
if(aEmp.GetRecordCount()>0) { aEmp.Edit(); } else { aEmp.AddNew();
}
aEmp.m_Salutation=(const char*)aQue.m_provtitle; aEmp.m_FirstName=(const char*)aQue.m_provfname; aEmp.m_LastName=(const char*)aQue.m_provlname; aEmp.m_EmployeeAddressAddr1=aQue.m_provdefaddr; aEmp.m_EmployeeAddressCity=aQue.m_provdefcity;
aEmp.m_EmployeeAddressPostalCode=aQue.m_provdefmcd; aEmp.m_Phone=aQue.m_provdefph; aEmp.m_AltPhone=aQue.m_provdefmob; aEmp.m_Email=aQue.m_provdefemail; aEmp.Update(); aQue.m_qbemplistid=aEmp.m_ListID; aEmp.Close();
The Error Message:
A Fatal Exception 0xxxxx has occured. Memory could not be read!
Following are two scenarion in 1st it gives the above message while in 2nd it works.
1- When QuickBooks has no employee in its database and I try to execute the above code then the error message given above appears
2- When QuickBooks has atleast ONE employee in its database then the above code works fine and from there it gives no error no matter I add 10 records or more.
Why?
Mumtaz
|