How To create connectivity with class file in .net windows application

// This code type in your class file.

public static object execmd(string qur)
        {
            OleDbConnection con = new OleDbConnection(constr);
            OleDbCommand cmd = new OleDbCommand(qur, con);
            con.Open();
            return cmd.ExecuteScalar();
        }


//This code type in your form

private void button1_Click(object sender, EventArgs e)
{
string str="      ";
namespace.classname.execmd(str);
messagebos.show("Data Is Submitted");
}