Results 1 to 2 of 2

Thread: app.config

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2009
    Posts
    32

    app.config

    Hi ,

    I'm creating window application with VB.NET and flatfiles.

    the problem is how do i store the connection string in the app.config file that include the application.startup path?

    <add name="cn" connectionString="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "\data\;Extended Properties=text;" />

    i got some error when writing to app.config.

    "Missing attribute value on attribute 'Application.StartupPath'."

    anyone know what's wrong?

    Pls Help?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: app.config

    xml Code:
    1. <add name="cn" connectionString="provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\data\;Extended Properties=text;" />
    The |DataDirectory| doesn't always point to the application startup folder but, in a non-ClickOnce app, it does by default.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

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



Click Here to Expand Forum to Full Width