Get name of access DB fron conn string?

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

    Get name of access DB fron conn string?

    hi all i need to get the acces database name, just the name doesn't need to include the .mdb

    i can use a substring to retrieve this, but the user can choose any database name from the sql server or acces db(obviously as long as the db structure is the same) meaning it can be any number long, which will be the problem

    how will i be able to retrieve this?

    What i do with the sql server is, i write the database to the registry and when ever i need it i read it, but problem lies with the access database.

    If this is confusing, all i need to get is the access database name from the file select?
  • Sl1ver
    New Member
    • Mar 2009
    • 196

    #2
    Solved it

    Code:
    FileInfo fi = new FileInfo("D:\\Qwix Asset\\qx_assetDB.mdb");
                string db = fi.Name.ToString();
                string dbNew = db.Replace(".mdb", "");

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      Code:
      string PathToFile = "D:\\Qwix Asset\\qx_assetDB.mdb";
      string dbName = [B]System.IO.Path.GetFileNameWithoutExtention[/B](PathToFile);

      Comment

      Working...