简体   繁体   中英

Connect to Access database that links to SharePoint lists using C#

I have an window application in which I am trying to connect to a Access Database that has a table linking to a SharePoint list using OLEDB in C#

My attempts:

  1. Use Access 2007 format for the database and Microsoft.ACE.OLEDB.12.0 for the ConnectionString
    • Everything works perfectly okay, until there's one guy reports the error " The 'Microsolf.ACE.OLEDB.12.0' provider is not registered on the local machine "
    • Check: he has Windows x86, Access 2003, but not 2007, and does not have "2007 Office System Driver: Data Connectivity Components" installed
    • Really troublesome and time-consuming to get these installed (Company's machine)
  2. Use Access 2003 format for the database and Microsoft.ACE.OLEDB.12.0 for the ConnectionString
    • Same error as the above. So I guess it is the "Microsoft.ACE.OLEDB.12.0" that causes the problem. But I don't know how to get it fixed.
  3. Using Access 2003 format for the database and Microsoft.Jet.OLEDB.4.0 for the ConnectionString
    • Error on my machine: " Could not find installable ISAM " (I don't have Access 2003, but only Access 2007)
    • His machine: works perfectly

Please help me point out what I can do to fix this problem without having every one update their Office version to 2007 or having the application check people's Office version before connecting to the Access database.

Thanks in advance.

You as a general rule cannot link to something else that is linking to the data!

If the data sitting on SharePoint why attempt to use Access here? You could never link to an Access database that has linked tables to SQL server, so this makes even LESS sense to hit SharePoint this way.

And worse I don't believe that SharePoint supports oleDB linked tables. While Access does support oldDB, and you trying to connect o Access you want to keep in mind that ADO been rather depreciated. While the Access data engine continues to receive all kinds of new features like complex data support (multi-value SharePoint columns), and things like a new-off line disconnected mode we have for Access 2010 with SharePoint, these features are certainly not appropoate to consume by attempting to link to linked tables. As noted, because Access is linked to SQL server or SharePoint in the past, no one would suggest you now attempt to link to the Access file which then in turn must make web service calls to SharePoint (BTW, Access makes web services calls to SharePoint to consume that data).

Since the data is on SharePoint, why are you attempting to hit some file based "thing" sitting on a local hard drive? Why don't you just hit the SharePoint site as a web service? There are tons of web services and ways to consume SharePoint lists in .net. I see little reason and advantage to dump all that fantastic technology and ability in .net to consume web services and then attempting to read some file based Access database that has links to SharePoint. The only way such a setup makes sense is if your development is primary in Access, and that then DOES make sense to dump the use of c# here and just use Access.

My suggestion is thus to consume the SharePoint lists in c#, and by-pass the Access data engine here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM