locked
web.config..please help RRS feed

  • Question

  • User-807621002 posted

    Greetings everyone,  I having what seems to be a common problem, but I cannot find the solution.  I developed an asp.net web site which works great in development mode but when I put it on my server I am having issues viewing any portion of the site that accesses my Microsoft Access 2007 mdb database.    My connection in the vb.net code is as follows

    conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source =" & _
            "c:\SCHEDULER\Scheduler.mdb"
            'conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source =" & _
            ' "c:\......\NameofDatabase.mdb"
            Try
                conn.Open() 

    My web config file is as follows:

    <configuration>
        <system.web>
     <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
     <customErrors mode="Off"/> 
        </system.web>
     

     <connectionStrings>
      <add name="DBCONN"
      "
      connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\...\databasename.mdb;"
      providerName="Microsoft.Jet.OLEDB.4.0;" />
        </connectionStrings>
    </configuration>

     

    I am thinking the issue may occur in the web.config file.

    Maybe I need more permissions on the specific folder of database.  Any tips would be great.. thank you!

     

    Tuesday, December 20, 2011 8:04 AM

Answers

  • User-1199946673 posted

    b)Made all the appropriate shares to the specific folder of the db location ie Network Service,asp.net users administrator have access to the db folder.

    First Identify which user should have access (using Environment.Username), and that user need to have MODIFY rights on the folder where the mdb file is in. Since it looks like your mdb file is on antoher server, this could be a problem.

    http://www.mikesdotnetting.com/Article/74/Solving-the-Operation-Must-Use-An-Updateable-Query-error

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 21, 2011 3:09 AM

All replies

  • User-2001332922 posted

    Hi canadianinnb,

    ;Data Source=C:\...\databasename.mdb;"

    replace the path to the absolute server path. verify and let forum know.

     

     

    Tuesday, December 20, 2011 8:09 AM
  • User-718146471 posted

    Make sure network service and aspnet user have read/write access to the database.

    Tuesday, December 20, 2011 8:10 AM
  • User-1011137159 posted

    Provide the proper access to user group so that all .net services related users will get access because they all are belongs to users group.

    Tuesday, December 20, 2011 8:23 AM
  • User-718146471 posted

    And for what its worth, here is a link to connectionstrings.com directly pointing to MS Access 2007

    Tuesday, December 20, 2011 8:25 AM
  • User-807621002 posted

    Thanks everyone,.. i will let the forum know how it goes.. I greatly appreciate the suggestions. Will give this a go.

    Tuesday, December 20, 2011 8:32 AM
  • User-231977777 posted

    Hi,

    put your access db into App_Data Folder , then , modify your connection string like this:-

    "Provider=Microsoft.Jet.OLEDB.4.0;Data source =|DataDirectory|\Scheduler.mdb"

    Here , The App_Data would resolved at runtime and replaced by Physical Path.whether you are in development or production environment.

    Hope this helps

    Tuesday, December 20, 2011 8:42 AM
  • User-807621002 posted

    Well still no luck, but I must becomming very close.  The changes I made were a)I set the path to the mdb to relative b)Made all the appropriate shares to the specific folder of the db location ie Network Service,asp.net users administrator have access to the db folder.

    As of now here is my web.config file.. I had heard that maybe the connection string was off but it is a Access2007 with an mdb extension,not accb.  So my web.config is:

     <configuration>
     <system.web>
      <compilation debug="false" strict="false" explicit="true"/>
      <customErrors mode="Off"/>
         </system.web>
        <connectionStrings>
          <add name="DBCONN" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\SERVERNAME\DATABASEFOLDER\Scheduler.mdb;"></add>
        </connectionStrings>
            </configuration>

    And my connection string is as follows in my application subroutine:
          
           
            conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source =" & _
            \\SERVERNAME\DATABASEFOLDER\Scheduler.mdb"      

     

    Thanks again

    Tuesday, December 20, 2011 9:11 AM
  • User-807621002 posted

    Maybe I have to do something in IIS and add the database folder ?

    Tuesday, December 20, 2011 9:20 AM
  • User-2001332922 posted

    And my connection string is as follows in my application subroutine:
          
           
            conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data source =" & _
            \\SERVERNAME\DATABASEFOLDER\Scheduler.mdb"      

    The quoted text is a re write of connection string in subroutine. Actually you have to fetch the web.config conn string like this:

    SqlConnection sqlcon = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["<DBCONN>"].ToString());

    This works for me.

    I suggest to verify the Connection object in your code and mentioned the connection string as in bold

    good luck

     

     

    Tuesday, December 20, 2011 10:52 PM
  • User-1199946673 posted

    b)Made all the appropriate shares to the specific folder of the db location ie Network Service,asp.net users administrator have access to the db folder.

    First Identify which user should have access (using Environment.Username), and that user need to have MODIFY rights on the folder where the mdb file is in. Since it looks like your mdb file is on antoher server, this could be a problem.

    http://www.mikesdotnetting.com/Article/74/Solving-the-Operation-Must-Use-An-Updateable-Query-error

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 21, 2011 3:09 AM
  • User3866881 posted

    Hello canadianinnb:)

    A better way to check whether there's a problem of permission or connection string's error——you can drag and drop an AccessDataSource onto the page,and then accroding to the wizard,you can create a connection to the specific access db,then switch to the web.config you can see the automatically-created connection string。

    Best reguards!

    Wednesday, December 21, 2011 9:29 PM
  • User-1199946673 posted

    A better way to check whether there's a problem of permission or connection string's error——you can drag and drop an AccessDataSource onto the page,and then accroding to the wizard,you can create a connection to the specific access db,then switch to the web.config you can see the automatically-created connection string。

    Decker.

    Sometimes I wonder if you worked with Access? Because the AccessDataSource DOESN'T create a connectionstring in web.config! You're describing waht would happen if you're using an SqlDataSource.

    Thursday, December 22, 2011 3:08 AM
  • User3866881 posted

    Decker.

    Sometimes I wonder if you worked with Access? Because the AccessDataSource DOESN'T create a connectionstring in web.config! You're describing waht would happen if you're using an SqlDataSource.

    Sorry,I am too quick to help others……

    Thursday, December 22, 2011 3:19 AM