I have a class library called SGDataLibrary
with a class SGMemberDataOp.cs
that holds all the data operations and gets the connection string to the database through the app.config
.
Here is the connection string
<add name="SimpleGym.Properties.Settings.SGYMConnectionString"
connectionString="Data Source=owner\sqlexpress;Initial Catalog=SGYM;Integrated Security=True"
providerName="System.Data.SqlClient" />
This is the SGMemberDataOp.cs
class
namespace SGDataLibrary
{
public class SGMemberDataOp
{
private string connectionString = Properties.Settings.Default.SGYMConnectionString;
Here is the code I am writing in my App.xaml.cs
file
public partial class App : Application
{
---->private static SGMemberDataOp sgMemberDataOp = new SGMemberDataOp();
public static SGMemberDataOp SGMemberDataOp
{
get { return sgMemberDataOp; }
}
}
The line with the arrow is throwing an exception
Object reference not set to an instance of an object