I am trying to make a program that will display a random data from my ms access database by clicking a button. And now i'm a bit of lost..
This is what i currently have. Can you help me find a way to display the datas from my database randomly each row?
{
OleDbConnection connection = new OleDbConnection();
connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\miguel\Documents\QuotesGenFunny.accdb;
Persist Security Info=False;";
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
command.CommandText = "SELECT Quote, Author FROM Funny";
OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
lblQuote.Text = (reader["Quote"].ToString());
lblAuthor.Text = ("-" + reader["Author"].ToString());
}
connection.Close();
}