Currently i manually define my connection string in my C# code:
string ConnectionString = "Data Source=C;Initial Catalog=tickets;Integrated Security=True";
SqlConnection Conn = new SqlConnection(ConnectionString);
Conn.Open();
In my project i have an app.config file and i can see that it has a connection string. It looks like this:
<?xml version="1.0"?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="ticketNotification.Properties.Settings.ticketsConnectionString"
connectionString="Data Source=C;Initial Catalog=tickets;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
How can i define the connection string based on the app.config file in the same folder as my application?