Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Dim queryString As String = _ "SELECT DISTINCT Code FROM enrolnment WHERE grade ='" & DropDownList2.Selectedvalue & "' AND Year ='" & DropDownList3.Selectedvalue & "'AND iActive = '1';" Using connection As New SqlConnection(connectionString) Dim command As New SqlCommand(queryString, connection) connection.Open() Dim reader As SqlDataReader = command.ExecuteReader() Dim i As Integer = 0 command.CommandTimeout = 300 While reader.Read() 'i < Listbox1.Items.Count ListBox1.Items.Add(reader.GetValue(i).ToString()) command.CommandTimeout = 300 End While reader.Close() 'End Try End Using End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)