title: restricted data type attribute violation - ODBC with Access Database
body: <p>I'm trying to add data into my Access database using MFC.
  I've two tables and after I add one record to the first table, I retrive the id and update the second table. Everything works fine for the first pass. But for the second record Table 1 rs.Update() throws an exception - restricted data type attribute violation. I'm using the same data for both records. The ID for Table 1 is auto generated. </p>
  
  <pre><code>function AddData(){
  
  rs.Open(CRecordset::snapshot, _T("SELECT * FROM Table1"));
  
  for ( each of the objects ) 
  {
      db.BeginTrans();
      rs.AddNew();  // Parent table
  
      m_xx = xx; 
      .......
      .....
  
     rs.Update(); 
  
     db.CommitTrans();
  
     id = GetParentId();  // Get Id of added record
  
     // Update the second table with id.
     UpdateSecondTable ( id ) ; 
  
   }
   rs.close(); 
  
  }
  
  
  int GetParentId(){
  
   rs.Open(CRecordset::forwardOnly, _T("SELECT @@Identity FROM Table1"));
   int id = rs.GetFieldValue(); 
   return id; 
  }
  </code></pre>
  
  <p>Thanks in advance. </p>