title: access list in sharepoint 2007 using c#
body: <p>I'm looking to compile data from a few diffrent custome lists in sharepoint 2007</p>
  
  <p>Its a hosted sharepoint site so I don't have access to the machine backend. </p>
  
  <p>Is there any example code to access the sharepoint site using c#?</p>
  
  <p>here is my code thus far (i get the error <strong>Cannot connect to the Sharepoint site ''. Try again later.</strong>)</p>
  
  <pre><code>    DataSet dt = new DataSet();
      string query = "SELECT * FROM list";
      string site = "http://sp.markonsolutions.com/Lists/Security/";
      string list = "35E70EO4-6072-4T55-B741-4B75D5F3E397"; //security db
      string myConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=2;RetrieveIds=Yes; DATABASE="+site+";LIST={"+list+"};";
      OleDbConnection myConnection = new OleDbConnection();
      myConnection.ConnectionString = myConnectionString;
      OleDbCommand myAccessCommand = new OleDbCommand(query,myConnection);
      OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(myAccessCommand);
      myConnection.Open();
  
  
  
            myDataAdapter.Fill(dt);
  
      //execute queries, etc
      myConnection.Close();
  </code></pre>