Hi plz help me to correct this code....
This code is showing just first result in texboxes...how to get rest plz help...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
cn.Open()
bindDp()
cn.Close()
End Sub
Public Sub bindDp()
cmd.Connection = cn
cmd.CommandText = "Select * From DP_Table"
Dim da As New SqlDataAdapter(cmd)
Dim dt As New DataTable()
da.Fill(dt)
DropDownList1.DataSource = dt
DropDownList1.DataTextField = ("P_id").ToString()
DropDownList1.DataValueField = ("P_id").ToString()
DropDownList1.DataBind()
DropDownList1.Items.Insert(0, "Select Name")
End Sub
Public Sub txtDp()
Dim stateTable As New DataTable
stateTable.Clear()
Dim sqlcmd As New SqlCommand("select P_id,P_Name From DP_Table Where P_id = '" & DropDownList1.SelectedItem.Value & "'", cn)
dr = cmd.ExecuteReader()
If dr.HasRows Then
dr.Read()
TB1.Text = (dr.Item("P_id"))
TB2.Text = (dr.Item("P_Name"))
End If
End Sub*Emphasized Text Here*
thnx