"Cannot be accessed with an instance reference; qualify it with a type name instead"
<p>I'm trying to create an application that can access a database, load the data and if the user adds any new fields, to save the data back into the database. As of right now, I am able to load the data into the application, but I am still unable to save any changes due to the error given above.</p>

<p>This is the save method</p>

<pre><code>    private void Save_Click(object sender, RoutedEventArgs e)
    {
        dataSource.updateDataSet(dataSet);
    }
</code></pre>

<p>And this is the SimeDataSource file</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
using System.Data;

class SimpleDataSource : IDisposable
{
    MySqlConnection conn;
    MySqlDataAdapter adapter = new MySqlDataAdapter();

public SimpleDataSource(string server, string database, int port,
    string user, string password)
{
    Connect(server, database, port, user, password); 
}

public void Connect(string server, string database, int port,
    string user, string password)
{

    string connectionString = "server=" + server + ";database=" + database + ";port=" + port + ";user=" + user + ";password=" + password;
    try
    {
        conn = new MySqlConnection(connectionString);
        conn.Open();
    }
    catch (MySqlException e)
    {
        Console.WriteLine("Error: {0}", e.ToString());
    }
    finally
    {
        if (conn == null)
        {
            conn.Close();
        }
    }
}

public MySqlDataReader Query(string queryString)
{
    // TODO: Declares MySqlDataReader and MySqlCommand objects.
    // When the MySqlCommand object is executed with the query
    // string, the return value will be assigned to the MySqlDataReader
    // object. This object is then returned with the "return" keyword.
    try
    {
        MySqlCommand cmd = new MySqlCommand(queryString, conn);
        cmd.ExecuteNonQuery();
    }
    catch (MySqlException e)
    {
        Console.WriteLine("Error: {0}", e.ToString());
    }
    return null;
}

public void Update(string updateString)
{
    try
    {
        MySqlCommand cmd = new MySqlCommand(updateString, conn);
        cmd.ExecuteNonQuery();
    }
    catch (MySqlException e)
    {
        Console.WriteLine("Error: {0}", e.ToString());
    }
}

public void Dispose()
{
    if (conn != null)
        conn.Dispose();
}

public void QueryPreparedStatement(string queryString, Dictionary&lt;string, string&gt; values)
{
    try
    {
        MySqlCommand cmd = new MySqlCommand(queryString, conn);
        foreach (string key in values.Keys)
        {
            cmd.Parameters.AddWithValue("@" + key, values[key]);
        }
        cmd.ExecuteNonQuery();
    }
    catch (MySqlException ex)
    {
        Console.WriteLine("Error: {0}", ex.ToString());
    }

}

public DataTable DataTableQuery(string sqlQuery)
{
    DataTable dt = new DataTable();
    MySqlCommand cmd = new MySqlCommand(sqlQuery, conn);
    MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);
    adapter.SelectCommand = cmd;
    try
    {
        adapter.Fill(dt);
        return dt;
    }
    catch (MySqlException ex)
    {
        Console.WriteLine("Error: {0}", ex.ToString());
        return null;
    }

}

public static void updateDataSet(DataSet dataSet)
{
    try
    {
        MySqlDataAdapter adapter = new MySqlDataAdapter();
        adapter.Update(dataSet);
    }
    catch (MySqlException ex)
    {
        Console.WriteLine("Error: {0}", ex.ToString());
    }
}
</code></pre>

<p>}</p>

<p>Edit:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Application_Development_Project
{
    /// &lt;summary&gt;
    /// Interaction logic for MainWindow.xaml
    /// &lt;/summary&gt;
    public partial class MainWindow : Window
    {
        private SimpleDataSource dataSource;
        private DataSet dataSet;

        public MainWindow()
        {
            InitializeComponent();
            dataSource = new SimpleDataSource
            ("*****","*****",*****,"*****","*****");
        }

        public void SimpleDataSource(string server, string database, int port, string user, string password)
        {
            string connectionString = "server=" + server + ";database=" + database + ";port=" + port + ";user=" + user + ";password=" + password;

        }

        private void Load_Click(object sender, RoutedEventArgs e)
        {
            DataTable dt = dataSource.DataTableQuery("SELECT * FROM Company");
            dataGrid.ItemsSource = dt.DefaultView;
        }

        private void Save_Click(object sender, RoutedEventArgs e)
        {
            SimpleDataSource.updateDataSet(dataSet);
        }

    }
}
</code></pre>