I am making an application that will automatically fetch information from database and display it on a textbox based on date. So for example i want to fetch a latest article on feb 25,2016. How do i do that? i need help cus im kinda new to c# Any help would be gladly appreciated. Please help me.

What type of database are you connecting to?

What does your table look like?

What code have you written so far?

 OleDbConnection cn = new OleDbConnection();
            cn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\`Hp\Desktop\PROGRAM1\notificationSystem\notificationSystem\Database.accdb";
            OleDbCommand cmd = new OleDbCommand();
            cmd.Connection = cn;
            //reg();
            cn.Open();
            cmd.CommandText = "select article from news where npublished = '" + metroDateTime1.Text + "' AND ntime = '" + label4.Text + "'";
            //AND ntime = '" + label4.Text + "'
            //Scalar executes the fetching of data


            var a = cmd.ExecuteScalar();
            //this statement gets the process of getting the data from the database to label          
            if (a != null)
            {
                label1.Text = "" + a.ToString();
                //while in this statement is displaying the data inside the textbox
                metroTextBox2.Text = label1.Text;
            }
            else if (metroTextBox2.Text != null)
            {
                //SEND SMS PROCESS
            }
            else if (metroTextBox2.Text == null)
            {
                //REPEAT FETCH
            }
            cn.Close();

I found a solution but have one problem, the code above works but its a manual fetch so i have to press a button everytime if i want to fetch, and i want to do it automatically and how would i do that?

Please help me on what should i do?