My problem is that I would like to read the complete record of a table in my database, well, so far, it brings me the information and shows it in the form that I should, because what I want to do is an update, only that I read all the records and the only one that shows me is the last record of that table.
while (reader.Read())
{
txtArticulo.Text = reader.GetString("Articulo");
txtArticulo.ForeColor = Color.Black;
txaDescripcion.Text = reader.GetString("Descripcion");
txaDescripcion.ForeColor = Color.Black;
txtCosto.Text = reader.GetString("Costo");
txtCosto.ForeColor = Color.Black;
spImportancia.Value = Convert.ToDecimal(reader.GetString("Importancia"));
if (reader.GetString("Obligatorio") == "no")
{
rbNo.Checked = true;
}
else if (reader.GetString("Obligatorio") == "si")
{
rbSi.Checked = true;
}
}
This reads all the records, what I want to do is just read the record that is selected in the table and fill it out on my form.
As you can see, select the second record, but always record the last one.