Hello Guys, Here is an interesting problem.
I have the following code. But it seems like I am missing out something in the process of populating drop down menus with data from database.
You guys have a look at it and please give your valuable suggestions.
Private Sub Open_Exam()
Dim con As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\VB Applications\PROJECT_1\PROJECT_1\examdb.mdf;Integrated Security=True;User Instance=True")
Dim cmd As New SqlCommand("Select Exam_No from Exam_Master Where Author='" + mniUsername.Text + "'", con)
con.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader()
While dr.Read()
tsmOpen_Exam.DropDown.Items.Add(dr.GetString)
End While
dr.Close()
con.Close()
End Sub
Thanks.