title: Getting Delphi 7 to play with SQL Server Compact 3.5
body: <p>We have an old application that was written in Delphi 7.  It is currently connected to an old Oracle Lite database that is being retired.  The powers that be have chosen to move the data to a Microsoft SQL Server Compact database instead.  After sepending a good amount of time moving everything over to the SQL CE database, I am now tasked with getting the Delphi application to play nice with the new databases.</p>
  
  <p>The people who are supposed to be smarter than I am (my boss), tell me that I should be able to simply modify the connection and everything should be back in order.  However, I have been banging my head against my monitor for two days trying to get the ADO connection in the Delphi application to work with our new SQL CE database.</p>
  
  <p>A slightly simplified example of what I'm working with:</p>
  
  <p>The connection is made in a global object with a TADOConnection named "adoConn":</p>
  
  <pre><code>procedure TGlobal.DataModuleCreate(Sender: TObject);
  begin
      adoConn.ConnectionString := 'Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=path\db.sdf;';
      adoConn.Connected := True;
  end;
  </code></pre>
  
  <p>Shortly after this, a procedure is called to populate some messages.  In an effort to trouble shoot the application, I've simplified the code to make a simple query and show the results in a message box.  The procedure receives a parameter for the SQL string, but I'm ignoring it for now and manually inserting a simple select statement:</p>
  
  <pre><code>procedure Select(const SQL: string);
  var
      adoQuery : TADOQuery;
  begin
      adoQuery := TADOQuery.Create(nil);
      try
          adoQuery.Connection := Global.adoConn;
          adoQuery.SQL.Text := 'select * from CLT_MESSAGES';
          adoQuery.ExecSQL;
          While not adoQuery.Eof do
          begin
              // Here I just created a MessageDlg to output a couple of fields.
              adoQuery.Next;
          end;
      finally
          adoQuery.Free;
      end;
  end;
  </code></pre>
  
  <p>Everything compiles just fine, but when I run the application I get the following error:</p>
  
  <p>"Multiple-step operation generated errors. Check each status value."</p>
  
  <p>I've done some additional trouble-shooting and found that the error is happening at adoQuery.ExecSQL.  I've tried several different versions of the connection string and a couple different ways of trying to query the data, but it all ends up the same.  I either can't connect to the database or I get that stupid "Mutliple-step" error.</p>
  
  <p>I appreciate, in advance, any assistance that can be offered.</p>