<%
Dim strConn As String = "Initial Catalog=RepairHistory;User Id=sa;Password=;Data source=DataCenter;Integrated Security=true"
Dim Conn As New SqlConnection(strConn)
Conn.Open()
Dim Sql As String
Dim i As Integer
Sql = "Select distinct(Year) FROM BudgetCodeTBL"
Dim cmd As New SqlCommand(Sql, Conn)
Dim da As New SqlDataAdapter(cmd)
Dim ds As New DataSet
da.Fill(ds, "BC")
Dim dt As DataTable
dt = ds.Tables("BC")
Dim dr As DataRow
For i = 0 To dt.Rows.Count - 1
%>
<li><a href="#">ปี <%Response.Write(dt.Rows(i)("Year"))%></a></li> ----> วน loop แสดงปีใน menu
<%
Next
%>