You need to do something like below if you are implementing it using ExecuteReader
Dim reader As SqlDataReader
reader = cmd.ExecuteReader()
While reader.Read()
End While
[UPDATE]
You may want to try this code out. Its not an elegant code and there are more elegant ways to do this but its pretty readable for begginers who are learning ADO.Net.
Dim strSQL As String
Dim connection As SqlConnection = New SqlConnection("Data Source=ML0003135586;Initial Catalog=TestSQL;Integrated Security=True")
strSQL = "Select CourseTitle from [tblTrainingPlan]"
connection.Open()
Dim command As New SqlCommand(strSQL, connection)
command.Parameters.AddWithValue("@Category", ddcategory.Text)
Dim DataReader As SqlClient.SqlDataReader = command.ExecuteReader()
Dim DatSource As New System.Data.DataTable
Dim column As DataColumn
Dim row As DataRow
column = New DataColumn
column.DataType = System.Type.GetType("System.String")
column.ColumnName = "CourseTitle"
DatSource.Columns.Add(column)
Do While DataReader.Read()
row = DatSource.NewRow
row("CourseTitle") = DataReader("CourseTitle")
DatSource.Rows.Add(row)
Loop
cbTitle.DataSource = DatSource
cbTitle.DataTextField = "CourseTitle"
cbTitle.DataValueField = "CourseTitle"
cbTitle.DataBind()
command.Dispose()
connection.Close()