I have a database access class which is contain INSERT,UPDATE,DELETE and READ. My INSERT,UPDATE, and DELETE is success full. Now i am stuck how to read the database item that i have inserted into database table. Here is what i do :
DBConnect.cs (A database class that created in a separated project but in a same solution)
public void Select()
{
#region fields
string sqlQuery;
#endregion
#region SQL Queries
sqlQuery = "SELECT NoNota, Nama, Tanggal, Tipe, Keterangan FROM master";
#endregion
#region execute
if (this.OpenConnection() == true)
{
cmd = new MySqlCommand(sqlQuery, connect);
cmd.ExecuteNonQuery();
CloseConnection();
}
#endregion
}
Here is my form that will consume that Select() function to display a database item. It's a winform named Report.cs (a WinForm that located in another project which is in a same solution)
Report.cs
private void btn_Tampil_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
ds = clsDBConnect.Select();
dgv_report.DataSource = ds;
}
What i got is i can't "convert Type 'void' to dataset". How to do the right way? what i missed here?