Results 1 to 2 of 2

Thread: connect to sharepoint 07 via oledb not working

  1. #1

    Thread Starter
    Fanatic Member Crash893's Avatar
    Join Date
    Dec 2005
    Posts
    930

    connect to sharepoint 07 via oledb not working

    I'm trying to access a list from sharepoint


    when I do i get an error


    Here is my code

    VB Code:
    1. DataSet dt = new DataSet();
    2.             string query = "SELECT * FROM list";
    3.             string site = "http://sp.markonsolutions.com/Lists/Security/";
    4.             string list = "35E70E04-6072-4F65-B741-4C75D5F3E327"; //security db
    5.             string myConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=2;RetrieveIds=Yes; DATABASE="+site+";LIST={"+list+"};";
    6.             OleDbConnection myConnection = new OleDbConnection();
    7.             myConnection.ConnectionString = myConnectionString;
    8.             OleDbCommand myAccessCommand = new OleDbCommand(query,myConnection);
    9.             OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(myAccessCommand);
    10.             myConnection.Open();
    11.  
    12.            
    13.  
    14.                   myDataAdapter.Fill(dt);
    15.                  
    16.             //execute queries, etc
    17.             myConnection.Close();

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: connect to sharepoint 07 via oledb not working

    first, why are you posting a c# question in a vb.net forum?

    here's a connectionstring to connect to sharepoint:

    vb Code:
    1. Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=2;RetrieveIds=Yes; DATABASE=http://pp1webofficelivecom.officelive.com/Documents/;LIST={5999B8A0-0C2F-4D4D-9C5A-D7B146E49698};

    from www.connectionstrings.com

    you'll probably find that you need to set your Target CPU to x86 to use Microsoft.ACE.OLEDB.12.0, but i don't know how to do that in c#

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width