Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
strsql = "SELECT DISTINCT(type_name) FROM View_GoodsType"
conn.connectdb()
cm = New SqlCommand(strsql, conn.cn)
rs = cm.ExecuteReader
ddltype_name.Items.Add("กรุณาเลือก")
While rs.Read
ddltype_name.Items.Add(rs("type_name"))
End While
conn.closedb()
End Sub
Protected Sub ddltype_name_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddltype_name.SelectedIndexChanged
strsql = "SELECT type_name_sub FROM View_GoodsType WHERE type_name='" & ddltype_name.SelectedIndex & "'"
conn.connectdb()
cm = New SqlCommand(strsql, conn.cn)
rs = cm.ExecuteReader
ddltype_name_sub.Items.Add("กรุณาเลือก")
While rs.Read
ddltype_name_sub.Items.Add("type_name_sub")
End While
conn.closedb()
End Sub
Tag : .NET, Ms SQL Server 2005, VS 2005 (.NET 2.x)