简体   繁体   中英

When an Access 2007 Database is set to “Working online with Sharepoint” mode, my application cannot connect properly

I have an ASP.NET application written in C# and hosted on IIS6 Win2k3. This web application connects through code to an Access 2007 Database which holds Sharepoint lists in tables.

To get an idea of how this works you can go here:

http://sharepoint.microsoft.com/blogs/GetThePoint/Lists/Posts/Post.aspx?ID=68

The issue is when the Access 2007 Database is set to “Working online with Sharepoint” mode my application cannot connect properly and pull records. If I take the database to “Work Offline” mode then my web application has no problems connecting and pulling records from the database.

Here are some connection strings that work fine in “Work Offline” Mode:

string objConnString = "Provider=Microsoft.ACE.OLEDB.12.0 ;Data Source=" + Server.MapPath("~/App_Data/Application.accdb"); // this works offline mode.

string objConnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("~/App_Data/ Application.accdb ") + ";Persist Security Info=True";

In “Working online with Sharepoint” mode the application will just sit and load all day long. Here are some strings I have tried:

string objConnString = "Provider=Microsoft.ACE.OLEDB.12.0 ;Data Source=" + Server.MapPath("~/App_Data/Application.accdb"); 

 //  No credentials are passed so doesn’t work as expected.

string objConnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath("~/App_Data/ Application.accdb") + @"User iD=User; Password=Pass ";

//The username and password are identical to the ones prompted by Access 2007 when opening up the database with “Working online with Sharepoint” mode activated.

I have given the even the regular internet user account and asp.net account full control to this Database so that part shouldn't be an issue. As I said it works in “Work Offline” mode so that confirms this.

This issue seems to be that when the application passes on the username and password to Access 2007 it still isn't allowing the records to be pulled. When I open the database in Access 2007 I will be prompted for my credentials; I put in the same credentials as I have in the connections strings that don't work.

I also wondered if it was possible to just save the username and password in Access 2007 itself so that they wouldn't be asked for at all.

Anybody have any ideas or connection strings that might make this thing work?

Thanks in advance.

As i understand it (but i could be wrong):

When sharepoint connects to the database it's a bit like mounting a database in sql, everything else is denied access and the sharepoint service gains full control of the database.

I believe therefore that you can only connect to the database when sharepoint is not online with it.

Your guide also shows this ... the guide explains that the database is offline, an edit / record is added to a table (contacts) then the user should return to sharepoint and resync.

After a resync the database connection between sharepoint and your access db should be disconnected again so that the application can then reconnect.

I would be interested to know more about the scenario but as a guess i am thinking you are trying to do something like this:

http://workerthread.wordpress.com/2009/02/03/using-access-2007-to-update-sharepoint-lists/

This may also be helpfull:

http://office.microsoft.com/en-us/access-help/create-access-forms-and-reports-from-a-sharepoint-list-HA010209306.aspx

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