Guest User

Untitled

a guest
Jan 23rd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. Public Sub Data(Position As Integer)
  2. Declare connection done
  3. Dim com As New MySqlCommand("SELECT * FROM Question WHERE QID = @QID ", MySQLConnection)
  4. com.Parameters.AddWithValue("@QID", FrmStandardQuizzes.CboQ.Text)
  5. Dim MysqlAdapter As New MySqlDataAdapter(com)
  6.  
  7.  
  8. MysqlAdapter.Fill(MyTable)
  9. TxtInsertQuestion.Text = MyTable.Rows(Position)(1).ToString
  10.  
  11. End Sub
  12. Private Sub BtnNext_Click(sender As Object, e As EventArgs) Handles BtnNext.Click
  13.  
  14.  
  15. Dim Position As Integer = 0
  16.  
  17.  
  18. Index += 1
  19.  
  20. Data(Index)
  21.  
  22.  
  23. Declared con
  24. Dim com As New MySqlCommand("SELECT * FROM Quiz WHERE NQuestions = @NumberofQuestions AND QId = @QId", MySQLConnection)
  25. Mycom.Parameters.AddWithValue("@QuizId", FrmQ.CboQ.Text)
  26. Mysqlcom.Parameters.AddWithValue("@NQuestions", LblNQuestions.Text)
  27.  
  28. Dim MysqlAdapter As New MySqlDataAdapter(com)
  29.  
  30.  
  31. MysqlAdapter.Fill(MyTable)
  32. LblNQuestions.Text = MyTable.Rows(Position)(2).ToString
  33.  
  34.  
  35.  
  36. If Index > LblNQuestions.Text Then
  37. Index = LblNQuestions.Text
  38. MessageBox.Show("You have successfully completed the Quiz.")
  39.  
  40. End If
  41.  
  42. End Sub
  43.  
  44. Private Sub BtnQBefore_Click(sender As Object, e As EventArgs) Handles BtnQBefore.Click
  45.  
  46. Index -= 1
  47. If Index < 0 Then
  48. Index = 0
  49. MessageBox.Show(" This is the first question.")
  50.  
  51. End If
  52. Data(Index)
  53.  
  54.  
  55. LblQNumber.Text = Count.ToString()
  56. End Sub
  57.  
  58. Private Sub Q_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  59.  
  60. Data(Index)
  61.  
  62. Private Sub BtnCheckA_Click(sender As Object, e As EventArgs) Handles BtnCheckA.Click
  63.  
  64. Dim Count As Integer = 0
  65.  
  66. Declared con
  67.  
  68. Try
  69. MySQLConnection.Open()
  70.  
  71. Dim com As New MySqlCommand("SELECT * FROM Ques WHERE QID = @ChooseQ ", MySQLConnection)
  72.  
  73. com.Parameters.AddWithValue("@ChooseQ", FrmStandardQuizzes.CboQ.Text)
  74.  
  75. Dim MysqlAdapter As New MySqlDataAdapter(com)
  76. Dim Position As Integer
  77. Dim MySqlDataReader As MySqlDataReader = MysqlCommand.ExecuteReader()
  78. MySqlDataReader.Dispose()
  79.  
  80. MysqlAdapter.Fill(MyTable)
  81.  
  82. If TxtInsertAnswer.Text = MyTable.Rows(Position)(2).ToString Then
  83.  
  84. TxtFeedback.Text = MyTable.Rows(Position)(3).ToString
  85. Count = Count + 1
  86.  
  87.  
  88.  
  89. ElseIf TxtInsertAnswer.Text <> MyTable.Rows(Position)(2).ToString Then
  90.  
  91. TxtFeedback.Text = MyTable.Rows(Position)(4).ToString
  92.  
  93. End If
  94.  
  95.  
  96. End Sub
Add Comment
Please, Sign In to add comment