Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Adding First Record to Employee Table FailsSearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC v7 Forum

 New Topic 
 
 Post Reply 
[1]  
 Adding First Record to Employee Table Fails 
 Author   Message 
  Mumtaz 
  
 Group: Members 
 Posts: 10 
 Joined: 2007-03-08 
 Profile
 Posted : 2007-03-08 20:20:08

I am using QuickBooks Premier Edition 2006/07 and accessing its database using QODBC V7. I have made an MFC application in Visual C++ 6.0 that adds record to Employee table after fetching from a FoxPro 6.0 Table. An Exception occurs only if I try to add the "First" record in Employee table using my application. Note the exception does not occur if there is at least one existing employee added using QuickBooks GUI but it only occurs when the employee table is empty and I try to add First record by using MFC CRecordset Class. 

Any help?

 

Mumtaz

 

 

 

 

 

 
Mumtaz Kazmi
Senior System Architect
Advanced Computer Systems Limited

145 Gihon Spring Drive
Rexdale, ON
Canada 
 
  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-03-08 20:43:31
Sorry, you haven't supplied the actual error or a sample of the SQL or code that fails. Try looking at: How do I add a new Employee? as there are "QuickBooks" rules. 

  Top 
  Mumtaz 
  
 Group: Members 
 Posts: 10 
 Joined: 2007-03-08 
 Profile
 Posted : 2007-03-09 21:48:24

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

 

 

 
Mumtaz Kazmi
Senior System Architect
Advanced Computer Systems Limited

145 Gihon Spring Drive
Rexdale, ON
Canada 
 
  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-03-09 23:24:10

Please review the QODBC Messages and SDK Messages logs for the real errors and advise.

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to