connectionStrings question

Discussion in 'ASP .Net Web Services' started by Craig Buchanan, Jul 25, 2006.

  1. I have configure my database's connection string the web.config's:

    <connectionStrings>
    <add name="MyDatabase"
    providerName="Microsoft.Jet.OLEDB.4.0"
    connectionString="Data Source=.\App_Data\MyDatabase.mdb;Persist
    Security Info=False"
    />

    Moreover, I can retrieve this setting using this code:

    Dim settings As ConnectionStringSettings =
    ConfigurationManager.ConnectionStrings("MyDatabase")
    Dim cn As New OleDbConnection(String.Concat("Provider=",
    settings.ProviderName, ";", settings.ConnectionString))

    I have two questions:
    1). Is there another way to get the 'full' connection string, rather
    than having to concatinate the ProviderName and ConnectionString properties?
    2). The '.\App_Data\MyDatabase.mdb' resolves to 'C:\Program
    Files\Microsoft\Visual Studio 8\Common7\IDE\App_Data\MyDatabase.mdb'. I
    would like this path to be relative to WebService's directory. Is there
    a way to do this?

    Thanks for your time,

    Craig Buchanan
    Craig Buchanan, Jul 25, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski
    Replies:
    16
    Views:
    2,400
    Juan T. Llibre
    Jun 25, 2005
  2. Dave
    Replies:
    3
    Views:
    5,853
  3. Replies:
    8
    Views:
    557
    =?Utf-8?B?REo=?=
    Mar 28, 2006
  4. Shawn Wildermuth

    Misunderstanding ConnectionStrings?

    Shawn Wildermuth, Jan 9, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    1,915
    Steven Cheng[MSFT]
    Jan 11, 2006
  5. Andy Sutorius via DotNetMonster.com

    sitemap connectionstrings

    Andy Sutorius via DotNetMonster.com, Jan 10, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    3,770
    Andy Sutorius via DotNetMonster.com
    Jan 11, 2006
Loading...

Share This Page