C# UNC path to an Access database

Results 1 to 3 of 3

Thread: C# UNC path to an Access database

  1. #1
    Join Date
    Dec 1969

    Default C# UNC path to an Access database

    I&#039;m working on a C# ASP.NET app, and I&#039;m having a problem with a connection string to an Access database. All of the examples I can find online se either server.mappath or the physical drive letter. However, all I have to work with in this case is a UNC path. What should the syntax for the connection string look like? <BR><BR>I tried "DATA Source=\server\dir\dir\file.mdb" but it keeps trying to resolve that down to "c:serverdirdirfile.mdb" as if the server was a directory! <BR><BR>So, please help! :) How do I get a UNC path to work as a data source path? I can do this in VB with "\serverdirdirfile.mdb", but I can&#039;t seem to figure out the similar code for C#

  2. #2
    Join Date
    Dec 1969

    Default is an escape character.

    Which you recoginzed for the directory separators, but neglected for the initial: \<BR><BR>So, the string, as you have it, is being read as:<BR>serverdirdirfile.mdb<BR><BR>Double up the initial \:<BR>DATA Source=\\server\dir\dir\file.mdb

  3. #3
    Join Date
    Dec 1969

    Default you can use @ too

    String source = @"\serverdirdirfile.mdb";

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts