开发者

connect Access via c#

i need to open a connection to a remote access db. in the local environment to the remote acess db is working great . when i run this application from production server (other server) it's fail with message

" It is already opened exclusively by another user, or you need permission to vie开发者_开发问答w its data. "

my code :

   conString =
       @"Provider=Microsoft.JET.OLEDB.4.0;"
     + @"data source=" \\150.248.248.38\d$\TestApp\vending.mdb;Jet OLEDB:Database Password=1234;";

      OleDbConnection connAccess = new OleDbConnection(conString);


    try
    {

        connAccess.Open();

        objDiningRoom.Connection = connAccess;

       ....
    }
    catch (Exception ex)
    {


    }
    finally
    {
        connAccess.Close();
        connAccess.Dispose();
    }

*Its not open in other place thanks


This looks like it is a permissions problem. Make sure you give the IUSR account (or whatever account ASP.NET runs as) read/write permissions to your database.


you can try :here copied from there :

  • This commonly occurs when your database file is opened exclusively
    by another application (usually MS
    Access). Close all applications that
    use this database and try again.
  • This error may occur if the account being used by Internet Information
    Server (IIS), (usually IUSR), does
    not have the correct Windows NT
    permissions for a file-based database or for the folder containing the
    file.
  • Check the permissions on the file and the folder. Make sure that you have the ability to create and/or destroy any temporary files. Temporary files are usually created in the same folder as the database, but the file may also be created in other folders such as /Winnt. If you use a network path to the database (UNC or mapped drive), check the permissions on the share, the file, and the folder.
  • Check to make sure that the file and the data source name (DSN) are not marked as Exclusive.
  • Simplify. Use a System DSN that uses a local drive letter. Move the database to the local drive if
    necessary to test.
  • The "other user" might be Visual InterDev. Close any Visual InterDev
    projects that contain a data
    connection to the database.
  • This error may also occur when accessing a local Microsoft Access
    database linked to a table where the
    table is in an Access database on a
    network server. In this situation,
    please refer to the following article in the Microsoft Knowledge Base for a workaround: Q189408 PRB: ASP Fails to Access Network Files Under IIS 4.0
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜