0
Hello, I’m trying to make a Windowsform with a button 'next' to display data in some Textbox see image:
This button is just an alternative, it should go through all the BD records from the first IF the textbox is not completed, if it is already completed, it must go through all records containing the NAME similar to the typed.
I tried to use the option Reader.NextResult()
but without success.
How should I proceed?
Follow code from Search button (magnifying glass):
private void button1_Click(object sender, EventArgs e)
{
//Declara sintrg de conexão com BD
OleDbConnection Connection = new OleDbConnection(@"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();
}
And if you store the results in a list and when you click on "next", search for the next
index
?– Leonardo
is an option, but I don’t know how to do it, I would have an example? :(
– Fellipe Signoretti Feitosa