Hello there,
I really need help ASAP.
A user has two students(maybe more) where he need to complete marking the score sheet for the students.
So, I have a score sheet where the user will insert their id in the textbox and then it will display the first studentName, studentID, studentTitle and studentProgram on the form.
Then the user will insert mark for the first student, and click button "next"
After clicking, the score sheet will display the second studentName, studentID, studentTitle and studentProgram on the form.
I only able to do up to the first student. I dont know how to read on the second row from the database.
I really need help cause I had try hard to solve the problem.
Hope to hear suggestions from the expert.
Below is some of my coding that i have done.
Imports FYPFOMS.connection
Imports MySql.Data.MySqlClient
Imports System.Data
Imports System.Web.UI
Partial Public Class extendProposal
Inherits System.Web.UI.Page
Private cmd As New MySqlCommand
Private dr As MySqlDataReader
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub ButtonSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelect.Click
Dim sqlStr As String
ConnectDatabase()
sqlStr = "SELECT a.StName, s.StId, s.StTitle, s.StProgramme FROM supervisor v, allocate a, student s WHERE(v.SvName = a.SvName) AND a.StName = s.StName AND SvId = '" & TextBoxID.Text & "'"
Dim cmd As New MySqlCommand(sqlStr, conn)
Try
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
While dr.Read()
LabelStudentName.Text = dr("StName").ToString
LabelStudentName.Visible = True
Label1.Visible = True
LabelStudentID.Text = dr("StId").ToString
LabelStudentID.Visible = True
Label2.Visible = True
LabelStudentTitle.Text = dr("StTitle").ToString
LabelStudentTitle.Visible = True
Label3.Visible = True
LabelStudentProgramme.Text = dr("StProgramme").ToString
LabelStudentProgramme.Visible = True
Label4.Visible = True
End While
Catch ex As Exception
'MsgBox.alert("Error create account " & ex.Message)
Finally
DisconnectDatabase()
End Try
End Sub
Protected Sub ButtonNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonNext.Click
Try
Dim myCommand As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
Dim myData As New DataTable
?????????