Data Source=|DataDirectory| --> question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sl1ver
    New Member
    • Mar 2009
    • 196

    Data Source=|DataDirectory| --> question

    Quick question what does this mean "Data Source=|DataDir ectory|" does that mean it automatically detects where the lets say Database is located or what?
  • nukefusion
    Recognized Expert New Member
    • Mar 2008
    • 221

    #2
    Hi Sl1ver,
    The special string "|DataDirectory |" normally points to the data folder in an ASP.NET application. By default I believe it is named "App_Data".

    So, as an example "|DataDirectory |\Mydatabase.md b" would translate into "App_Data\Mydat abase.mdb".

    Hope that helps.

    Comment

    • arashy7
      New Member
      • Aug 2009
      • 2

      #3
      Hi,

      Thanks, your post helped me. But is there any way to detect the location of data directory in the runtime?

      Let me specifically explain my problem. I use typed datasets with connection to my local access database in App_Data. It works perefctly on my system, but when I transfer it to the server it stops connecting to the DB. The connection string in the web.config file is defined as:
      Code:
      		<add name="db_workshopConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\db_workshop.mdb" providerName="System.Data.OleDb"/>
      Now I am looking for a way to fix this issue.

      Thanks

      Comment

      • mohammad fares

        #4
        happy news for winforms coders

        it works also for winforms
        i have just tried it and it works really fine
        thanx people


        major

        Comment

        Working...