Partial Class test2
Inherits System.Web.UI.Page
Dim Conf As System.Configuration.Configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/")
Dim Conn As New SqlConnection(Conf.ConnectionStrings.ConnectionStrings("Conn").ToString)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim sql As String = "SELECT machine_id FROM UBA_machine_property where Machine_id is not null GROUP BY machine_id"
Dim da1 As New SqlDataAdapter(sql, Conn)
Dim ds1 As New DataSet
Dim tmp As New ListItem("----", "")
da1.Fill(ds1)
ddl1.DataSource = ds1
ddl1.DataValueField = "machine_id"
ddl1.DataTextField = "machine_id"
ddl1.DataBind()
tmp = New ListItem("----", "")
ddl1.Items.Insert(0, tmp)
End Sub
Protected Sub ddl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddl1.SelectedIndexChanged
Dim Strddl1 As String
Strddl1 = ddl1.SelectedValue.ToString
Label1.Text = Strddl1
Dim sql As String = "SELECT property_name_en,machine_id FROM UBA_machine_property where machine_id = '" & Strddl1 & "'"
Dim da2 As New SqlDataAdapter(sql, conn)
Dim ds2 As New DataSet
da2.Fill(ds2)
ddl2.DataSource = ds2
ddl2.DataTextField = "property_name_en"
ddl2.DataValueField = "machine_id"
ddl2.DataBind()
End Sub
End Class
IF NOT Page.IsPostBack() Then
Dim da1 As New SqlDataAdapter(sql, Conn)
Dim ds1 As New DataSet
Dim tmp As New ListItem("----", "")
da1.Fill(ds1)
ddl1.DataSource = ds1
ddl1.DataValueField = "machine_id"
ddl1.DataTextField = "machine_id"
ddl1.DataBind()
tmp = New ListItem("----", "")
ddl1.Items.Insert(0, tmp)
End IF
Dim sql As String
sql = "SELECT id FROM member"
Dim Cmd As New OleDbDataAdapter(sql, Conn)
Dim ds As New DataSet
Cmd.Fill(ds, "id")
cbo.DisplayMember = "id"
cbo.ValueMember = "id"
cbo.DataSource = ds.Tables("id")