How do I go about showing data in a database in a table or rich text box, so far I have this:
public static void showDogs()
{
OleDbConnection myConnection = GetConnection();
string command2 = "SELECT * FROM dogs";
OleDbCommand myCmd2 = new OleDbCommand(command2, myConnection);
try
{
myConnection.Open();
OleDbDataReader myReader = myCmd2.ExecuteReader();
}
catch (Exception)
{
Console.WriteLine("Exception in DBHandler");
}
finally
{
myConnection.Close();
}
and in my form I have:
private void showDogsBtn_Click(object sender, EventArgs e)
{
DBConnection.showDogs();
}
I don't know how to link the method to my rich text box to get it to print the values in the database.