title: Cannot assign data to client dataset
body: <p>I'm using <code>TClientDataSet</code> assigned with local data in my Delphi application to compare data between 2 tables located in 2 different databases. Things I'm using:</p>
  
  <ul>
  <li><code>SpPlansQuery: TADOQuery</code> – original data query </li>
  <li><code>PPUQuery: TADOQuery</code> – changed data query (uses different ADO connection than SpPlansQuery)</li>
  <li><code>ComparisonDataSet: TClientDataSet</code> – dataset showing only differences between 2 previous queries</li>
  </ul>
  
  <p>I'm trying to fill <code>ComparisonDataSet</code> as follows (I heavily reduced my code to highlight problem):
  </p>
  
  <pre class="lang-pascal prettyprint-override"><code>procedure TComparisonSpPlanForm.RefillDataSet;
  const
    // IMPORTANT: check that fields count in next 2 lines would be the same
    FieldsStr1 = 'Article_PPU;Contractor_S_PPU;Recipient_S_PPU;OrderNum_PPU;OrderNum2_PPU;OrdN_PPU;Title_PPU;Queue_PPU;KolSht_PPU;Weight1_PPU;Material_PPU;Drawing_PPU;Graph_PPU';
    FieldsStr2 = 'Title_1;Title_3;Title_4;num;inum;onum;Title;QNum;num_of;weight;Title_2;Drawing;Graph';
  var
    Deleted: Boolean;
    FieldValues2: Variant;
    FieldValues1: Variant;
  begin
    ComparisonDataSet.DisableControls;
    // clear ComparisonDataSet
    if ComparisonDataSet.Active then
      ComparisonDataSet.Close;
    ComparisonDataSet.CreateDataSet;
    // deleted records
    SpPlansQuery.First;
    while not SpPlansQuery.Eof do
    begin
      FieldValues1 := SpPlansQuery[ReplaceStr(FieldsStr1, '_PPU', '')];
      Deleted := not PPUQuery.Locate('ID', Integer(SpPlansQuery['PPONREC']), []);
      if Deleted then
      begin
        ComparisonDataSet.Append;
        // next string throws exception and this is a big problem
        ComparisonDataSet[ReplaceStr(FieldsStr1, '_PPU', '')] := FieldValues1; 
        ComparisonDataSet.Post;
      end;
      SpPlansQuery.Next;
    end;
    ComparisonDataSet.First;
    ComparisonDataSet.EnableControls;
  end;
  </code></pre>
  
  <p>As far you can guess, ComparisonDataSet contains fields named <code>ARTICLE</code> and <code>ARTICLE_PPU</code> and exception with message "Cannot convert variant type of (Null) into type (Integer)" occurs when I try to assign value to <code>ComparisonDataSet['ARTICLE']</code>. I know this because I tried assigning directly to that field but got the same result.</p>
  
  <p><code>ARTICLE</code> is a string field with length of 20 characters.</p>
  
  <p>Can anyone point me how to assign values to fields in a TClientDataSet without getting errors?</p>
  
  <p>As requested below, this is my field definition:</p>
  
  <p>In <code>ComparisonSpPlanUnit.dfm</code>:</p>
  
  <pre class="lang-pascal prettyprint-override"><code>object ComparisonDataSet: TClientDataSet
    Aggregates = &lt;&gt;
    FieldDefs = &lt;
    ...
      item
        Name = 'ARTICLE'
        DataType = ftString
        Size = 20
      end&gt;
    ...
    object ComparisonDataSetARTICLE: TStringField
      DisplayLabel = #1057#1090#1072#1090#1100#1103
      FieldName = 'ARTICLE'
    end
    ...
  end
  </code></pre>
  
  <p>In <code>ComparisonSpPlanUnit.pas</code>:</p>
  
  <pre class="lang-pascal prettyprint-override"><code>ComparisonDataSetARTICLE: TStringField;
  </code></pre>