public inRaspunsSimplu readDb(int id) { inRaspunsSimplu intr = new inRaspunsSimplu("etc","etc", 1); return intr; }
protected void buttonStart_Click(object sender, EventArgs e) { string sql = "INSERT INTO utilizatori (nume, email, punctaj) VALUES ('" + textBoxNume.Text + "', '" + textBoxEmail.Text + "', 0)"; SqlCommand comm = new SqlCommand(sql, conn); //comm.ExecuteNonQuery(); user.numef = textBoxNume.Text; user.emailf = textBoxEmail.Text; sql = "SELECT * FROM intrebari WHERE tip=1"; comm = new SqlCommand(sql, conn); SqlDataReader read = comm.ExecuteReader(); int i = 0; mata = "MATA"; while (read.Read()) { raspSimplu[i] = new inRaspunsSimplu(read[1].ToString(), read[2].ToString(), int.Parse(read[3].ToString())); i++; } read.Close(); sql = "SELECT * FROM intrebari WHERE tip=2"; comm.CommandText = sql; read = comm.ExecuteReader(); i = 0; while (read.Read()) { raspMultiplu[i] = new inRaspunsMultiplu(read[1].ToString(), read[2].ToString(), read[3].ToString()); i++; } Response.Redirect("quiz.aspx?intrebare=2"); }