Click here to Skip to main content
15,905,148 members

Comments by DPaul1994 (Top 27 by date)

DPaul1994 31-Mar-15 5:44am View    
It works with 0..I get it now. Thank you very much for your help and time!
DPaul1994 31-Mar-15 5:41am View    
Interesting, it worked..so I have to assing the value -1?
DPaul1994 31-Mar-15 5:27am View    
Hmm I don't really understand, how it can be the same variable? `rows` is total rows that is never modified and `currentrow` is the current id for each row.
DPaul1994 31-Mar-15 4:58am View    
Well I kinda modify the code now. select() function looks like this:
private void select()
{
using (Conexiune.getConnection())
{
string select = String.Format("SELECT * FROM questions WHERE id > {0} ORDER BY id ASC LIMIT 1",rows);
SQLiteCommand cmd = new SQLiteCommand(select, Conexiune.getConnection());
cmd.CommandType = CommandType.Text;
SQLiteDataReader rdra = cmd.ExecuteReader(CommandBehavior.CloseConnection);
try
{
while (rdra.Read())
{
textBox1.Text = rdra["question"].ToString();
textBox2.Text = rdra["answer1"].ToString();
textBox3.Text = rdra["answer2"].ToString();
textBox4.Text = rdra["answer3"].ToString();
r1 = (int)rdra["option1"];
r2 = (int)rdra["option2"];
r3 = (int)rdra["option3"];
currentrow = Convert.ToInt32(rdra["id"]);
SimulatorManager.Intrebare = textBox1.Text;
label11.Text = currentrow.ToString();
}
}
catch (InvalidOperationException ex)
{
MessageBox.Show(ex.Message);
}
}
}

Is ok now?
DPaul1994 31-Mar-15 4:49am View    
Is ok, I know what's the problem. `rows` value is always 1, is not passing to the next row. This is the error. query is the problem I guess or something before that while or in while..