hii
i am trying to retrieve data in dropdownlist from two diff columns in two different tables .is it possible?
and the code i tried is as follows
Private Sub DropDownList1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.Load
Try
cn.Open()
cmd1 = New OleDbCommand("select component from components", cn)
dr1 = cmd1.ExecuteReader()
DropDownList1.DataSource = dr1
DropDownList1.DataTextField = "component"
DropDownList1.DataBind()
dr1.Close()
cmd2 = New OleDbCommand("select terminal from terminals", cn)
dr2 = cmd2.ExecuteReader()
DropDownList1.DataSource = dr2
DropDownList1.DataTextField = "terminal"
DropDownList1.DataBind()
dr2.Close()
Catch ex As Exception
Response.Write(ex.Message)
End Try
cn.Close()
End Sub
where component is one column from components table and terminal is one column from another terminal table
where is my code going wrong
any suggestions
i am trying to retrieve data in dropdownlist from two diff columns in two different tables .is it possible?
and the code i tried is as follows
Private Sub DropDownList1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.Load
Try
cn.Open()
cmd1 = New OleDbCommand("select component from components", cn)
dr1 = cmd1.ExecuteReader()
DropDownList1.DataSource = dr1
DropDownList1.DataTextField = "component"
DropDownList1.DataBind()
dr1.Close()
cmd2 = New OleDbCommand("select terminal from terminals", cn)
dr2 = cmd2.ExecuteReader()
DropDownList1.DataSource = dr2
DropDownList1.DataTextField = "terminal"
DropDownList1.DataBind()
dr2.Close()
Catch ex As Exception
Response.Write(ex.Message)
End Try
cn.Close()
End Sub
where component is one column from components table and terminal is one column from another terminal table
where is my code going wrong
any suggestions