private void button1_Click(object sender, EventArgs e) { StudentLinqDataContext quest = new StudentLinqDataContext(); exam exm = new exam(); exm.ques = textBox1.Text; exm.ans = ans; exm.marks = 1; quest.exams.InsertOnSubmit(exm); quest.SubmitChanges(); MessageBox.Show("Question added successfully"); textBox1.Text = null; }
private void button1_Click(object sender, EventArgs e) { groupBox1.Show(); //Random rnd = new Random(); //int val = rnd.Next(1, 10); val++; // MessageBox.Show(val.ToString()); try { totalmark = totalmark + 1; { using (StudentLinqDataContext ques = new StudentLinqDataContext()) { exam xm = ques.exams.Single(quiz => quiz.id == val); label1.Text = (xm.ques); if (xm.ans == answer) { achivedmark = achivedmark + 1; } else { achivedmark = achivedmark + 0; } // MessageBox.Show(val.ToString()); //label1.Show(); // MessageBox.Show("ques "+xm.question); } } } catch { MessageBox.Show("Exam is over your mark is" + achivedmark.ToString() + "out of" + totalmark.ToString()); this.Dispose(); //this.Show(); } }
partial void Updateexam(exam instance);
partial void Deleteexam(exam instance);
partial void Insertexam(exam instance);