currently i'm studying MySQL, sorry for my newbie question. Here my question
I have 2 class, the first one is Windows Form, and the other is just a class which I want contain all processes from SQL. here's my code in SQL Class
public void SampleQuery(string tablename)
{
DataTable dataTable;
string query = "SELECT * FROM " + tablename;
//Open connection
if (this.OpenConnection() == true)
{
adapter = new MySqlDataAdapter(query,connection);
dataTable = new DataTable();
adapter.Fill(dataTable);
//close Connection
this.CloseConnection();
return;
}
What I want to do is, show the data from SQL with DataGridView. Is it possible to code the datagridview in SQL Class above? or must be in Windows Form part?
if must be in windows form, how to throw the dataTable which is now hold all the data to Windows Form class?
thanks a lot for helping me. If my question sounds absurd just ask me.