I am beginner in C#, so this question may be a bit stupid but...
I would like to send some SQL command as string from one class to another, execute and then return result to the first class.
    class MainWindow
private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            TestConnection checkLogin = new TestConnection();
            checkLogin.SimpleQuery("SELECT Name FROM Names WHERE ID='1'", "");
            //MessageBox .Show(checkLogin.SimpleQuery(response:ToString));
        }
And class TestConnection
  public string SimpleQuery(string request, string response)
    {
        using (SqlConnection conn = new SqlConnection())
        {
            conn.ConnectionString = "Server=SQLOLEDB.1;User ID=" +
                Constants.DATABASE_USERNAME + ";Password=" +
                Constants.DATABASE_PASSWORD + ";Initial Catalog=" +
                Constants.DATABASE_CATALOG + ";Data Source=" +
                Constants.SERVER_ADRESS;
            SqlCommand command = new SqlCommand(request, conn);
            {
                conn.Open();
                response = Convert.ToString (command.ExecuteScalar());
                conn.Close();
                return response; 
            }
        }
Is something like this even an OK idea? I am learning and I am testing ideas..
Thank you!
 
     
     
     
    