Results 1 to 10 of 10

Thread: Where to set ConfigurationSettings.AppSettings? [Resolved]

  1. #1

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Where to set ConfigurationSettings.AppSettings? [Resolved]

    Where can I set the ConnectionString that is referred to in this line of code?

    VB Code:
    1. Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))

    Here is original link with full code:

    http://authors.aspalliance.com/das/insertimage.html

    From this article:

    http://aspalliance.com/articleViewer.aspx?aId=138&pId=

    Thanks!
    Last edited by Dave Sell; May 11th, 2005 at 09:55 PM.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Where to set ConfigurationSettings.AppSettings?

    Dave, ConfigurationSettings sounds like its the name of the project and AppSettings is the name of a class? Its probably grabbing
    the ConnectionString property from that class. I noticed that the article refers to it on other examples too but without
    definition. You could probably re-create it if you cant find it on thir site.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Where to set ConfigurationSettings.AppSettings?

    The .CONFIG file.

  4. #4

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Where to set ConfigurationSettings.AppSettings?

    I don't have a .CONFIG file. Its a stand-alone .ASPX file.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Where to set ConfigurationSettings.AppSettings?

    web.config, to be specific.

    Code:
     <configuration>
      <appSettings>
        <add key="ConnectionString"
          value="sdlfkjaslfkjasdlfkjasdlfkjasdflk" />
      </appSettings>
      <system.web>
        <customErrors mode="Off"/>
      </system.web>
    </configuration>

  6. #6

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Where to set ConfigurationSettings.AppSettings?

    How can I associate a .CONFIG file to this stand-alone .aspx file? When I open the .aspx file in vis stud, it doesn't make a Solution or Project. There is just the file... Any pointers greatly appreciated.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Where to set ConfigurationSettings.AppSettings?

    Quote Originally Posted by Dave Sell
    I don't have a .CONFIG file. Its a stand-alone .ASPX file.
    Then you might as well store your connection string in a variable and forget about configurationsettings.

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Where to set ConfigurationSettings.AppSettings?

    We're talking out of sync

    Create a new web project and add the aspx file to the solution.

    Or just copy over the aspx and code to the existing .aspx in the new solution.

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Where to set ConfigurationSettings.AppSettings?

    Just make sure the page directive isn't copied over.

  10. #10

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Where to set ConfigurationSettings.AppSettings?

    Mendhak's advice was right-on. kudos! Thanks all!
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

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