Почему Reader.Read() начинает чтение не с первой строки данного столбца? Класс Oledb.Или может он ее перескакивает?
Проблема в том что я вызываю Reader.read() при открытии формы .И reader возвращает не первую строку ,а вторую строку столбца . Как мне возвратить именно первую? А если убрать Read.Read() он мне ничего не возвратит,потому что ничего я не прочитал.Тем кто откликнется буду рад ,искал в интернете ,на подобную проблему не натолкнулся.
private void Form5_Load(object sender, EventArgs e)
{
Connection.Open();
OleDbCommand command = new OleDbCommand("SELECT *FROM [Тесты] WHERE [Название предмета] = @NamePred AND [Название теста] = @NameTest", Connection);
command.Parameters.AddWithValue("NamePred", pred);
command.Parameters.AddWithValue("NameTest", test);
OleDbDataReader reader = command.ExecuteReader();
string[] arrayOtvet = new string[7];
const int n = 6;
int[] perm = Enumerable.Range(0, n).ToArray();
Random r = new Random();
for (int i = n - 1; i >= 1; i--)
{
int j = r.Next(i + 1);
int temp = perm[j];
perm[j] = perm[i];
perm[i] = temp;
}
reader.Read();
label1.Text = reader[2].ToString();
arrayOtvet[5] = reader[3].ToString();
arrayOtvet[4] = reader[4].ToString();
arrayOtvet[3] = reader[5].ToString();
arrayOtvet[2] = reader[6].ToString();
arrayOtvet[1] = reader[7].ToString();
arrayOtvet[0] = reader[8].ToString();
radioButton1.Text = arrayOtvet[perm[0]];
radioButton2.Text = arrayOtvet[perm[1]];
radioButton3.Text = arrayOtvet[perm[2]];
radioButton4.Text = arrayOtvet[perm[3]];
radioButton5.Text = arrayOtvet[perm[4]];
radioButton6.Text = arrayOtvet[perm[5]];
if (radioButton1.Text != "")
{
radioButton1.Visible = true;
}
if (radioButton2.Text != "")
{
radioButton2.Visible = true;
}
if (radioButton3.Text != "")
{
radioButton3.Visible = true;
}
if (radioButton4.Text != "")
{
radioButton4.Visible = true;
}
if (radioButton5.Text != "")
{
radioButton5.Visible = true;
}
if (radioButton6.Text != "")
{
radioButton6.Visible = true;
}
Connection.Close();
}
Я прикрепил изображение с таблицей к которой я обращаюсь ,возвращает мне значения 2-ой строки ,а необходимо первую.
