How to create a 'next record' button for a DB in C #

0
Hello, I'm trying to make a WindowsForm with a ' next' button to show data in some TextBox vide image:

Thisbuttonisonlyanalternative,itshouldgothroughalltheBDrecordssincethefirstSEthetextboxisnotfilled;ifitisalreadyfilled,itmustgothroughallrecordsthatcontaintheNAMEsimilartotyped.

ItriedtousetheReader.NextResult()optionbutwithoutsuccess.

HowdoIproceed?

FollowtheSearchbutton(magnifyingglass):

privatevoidbutton1_Click(objectsender,EventArgse){//DeclarasintrgdeconexãocomBDOleDbConnectionConnection=newOleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\xxxxx.accdb");

        //Abrir conexão com BD
        Connection.Open();

        //Declarar Comando SQL
        OleDbCommand Command = Connection.CreateCommand();
        Command.CommandText = "SELECT * FROM tb_YYYY WHERE Nome LIKE '%" + txtUserOUNome.Text + "%'";

        //Declarar DataReader
        OleDbDataReader Reader = Command.ExecuteReader();

        while (Reader.Read())
        {
            txtPesqNome.Text = Convert.ToString(Reader["Nome"]);
            txtPesqUsuario.Text = Convert.ToString(Reader["Usuario"]);
            txtPesqMail.Text = Convert.ToString(Reader["Mail"]);
        }

        //Fechar Reader e Conexão
        Reader.Close();
        Connection.Close();
    }
    
asked by anonymous 20.09.2017 / 17:15

0 answers