Click here to Skip to main content
15,895,423 members
Home / Discussions / C#
   

C#

 
GeneralRe: Best way to access a database Pin
PIEBALDconsult2-May-10 10:29
mvePIEBALDconsult2-May-10 10:29 
GeneralRe: Best way to access a database Pin
Pete O'Hanlon2-May-10 10:33
mvePete O'Hanlon2-May-10 10:33 
GeneralRe: Best way to access a database Pin
PIEBALDconsult2-May-10 10:53
mvePIEBALDconsult2-May-10 10:53 
GeneralRe: Best way to access a database Pin
Terence van Schalkwyk2-May-10 20:01
Terence van Schalkwyk2-May-10 20:01 
GeneralRe: Best way to access a database Pin
Pete O'Hanlon2-May-10 20:38
mvePete O'Hanlon2-May-10 20:38 
GeneralRe: Best way to access a database Pin
Terence van Schalkwyk2-May-10 20:58
Terence van Schalkwyk2-May-10 20:58 
GeneralRe: Best way to access a database Pin
Pete O'Hanlon2-May-10 21:21
mvePete O'Hanlon2-May-10 21:21 
QuestionRe: Best way to access a database [modified] Pin
Terence van Schalkwyk2-May-10 23:37
Terence van Schalkwyk2-May-10 23:37 
I am using visual studio 2008....

Thanks for that!!! I hope this is the last question!!! Its still not liking ConfigurationManager. Does not exist in current context. Am I supposed to initialise this somewhere?

Also in this part of the code "connection_string_stored_in_config_file" is this the section in the config file?

Here is how my code looks:

using System.Configuration;


namespace testapp
{
    public static class Settings
    {
        private static string _connectionString = string.Empty;

        public static string ConnectionString
        {
            get
            {
                if (string.IsNullOrEmpty(_connectionString))
                    _connectionString = ConfigurationManager.ConnectionStrings["connection_string_stored_in_config_file"];
                return _connectionString;
            }
        }
    }
}


Here is my App.config file. Is this correct so far and how do I put my connection string in?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="MyConnection" connectionString=""></add>
  </connectionStrings>
  
</configuration>


modified on Monday, May 3, 2010 7:00 AM

AnswerRe: Best way to access a database Pin
Pete O'Hanlon3-May-10 2:33
mvePete O'Hanlon3-May-10 2:33 
Questionimage protect Pin
hameduser2-May-10 4:40
hameduser2-May-10 4:40 
AnswerRe: image protect Pin
Dave Kreskowiak2-May-10 5:51
mveDave Kreskowiak2-May-10 5:51 
GeneralRe: image protect Pin
AspDotNetDev2-May-10 14:14
protectorAspDotNetDev2-May-10 14:14 
GeneralRe: image protect Pin
loyal ginger2-May-10 14:32
loyal ginger2-May-10 14:32 
GeneralRe: image protect Pin
AspDotNetDev2-May-10 19:15
protectorAspDotNetDev2-May-10 19:15 
GeneralRe: image protect Pin
loyal ginger3-May-10 17:38
loyal ginger3-May-10 17:38 
GeneralRe: image protect Pin
Dave Kreskowiak2-May-10 14:38
mveDave Kreskowiak2-May-10 14:38 
GeneralRe: image protect Pin
AspDotNetDev2-May-10 19:20
protectorAspDotNetDev2-May-10 19:20 
GeneralRe: image protect Pin
Anthony Mushrow2-May-10 15:37
professionalAnthony Mushrow2-May-10 15:37 
GeneralRe: image protect Pin
AspDotNetDev2-May-10 19:19
protectorAspDotNetDev2-May-10 19:19 
QuestionDropDownList inside GridView Pin
msomar1-May-10 21:57
msomar1-May-10 21:57 
AnswerRe: DropDownList inside GridView Pin
Abhinav S1-May-10 22:42
Abhinav S1-May-10 22:42 
GeneralRe: DropDownList inside GridView Pin
Abdul-Rhman Alsri2-May-10 10:10
Abdul-Rhman Alsri2-May-10 10:10 
Questionmethod parameters error Pin
Abdul-Rhman Alsri1-May-10 17:00
Abdul-Rhman Alsri1-May-10 17:00 
AnswerRe: method parameters error Pin
Abhinav S1-May-10 17:15
Abhinav S1-May-10 17:15 
GeneralRe: method parameters error Pin
Abdul-Rhman Alsri1-May-10 18:43
Abdul-Rhman Alsri1-May-10 18:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.