Hi ,
Ihave modified the code as below...but now it is saying : There is no row at position 0.
Dim sqlcmd As String = ("select * From DP_Table Where P_id = '" & DropDownList1.SelectedItem.Value & "'")
Dim ad As New SqlDataAdapter(sqlcmd, cn)
Dim ds As New DataSet
ad.Fill(ds, "DP_Table")
TB1.Text = ds.Tables("DP_Table").Rows(0)("P_id").ToString
TB2.Text = ds.Tables("DP_Table").Rows(0)("P_Name").ToString
Plz help

Iftikar HussainRank #423 · 5.9K reputationPosted Jul 7, 2013, 9:06 AM EDT
Regards,
Iftikar
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 7, 2013, 4:17 AM EDT
Aman Jen136 reputationPosted Jul 7, 2013, 4:39 AM EDT
Only first part is working fine...
Plz hav luk
1)---------Binding Dropdownlist code--------
-2)----------Retriveing data code
Dim sqlcmd As New SqlCommand("select P_id,P_Name From DP_Table Where P_id = '" & DropDownList1.SelectedItem.Value & "'", cn)
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 7, 2013, 4:48 AM EDT
What value you are getting for DropDownList1.SelectedItem.Value while reteriving the data?
Can you put break point in the below link and check
Dim sqlcmd As New SqlCommand("select P_id,P_Name From DP_Table Where P_id = '" & DropDownList1.SelectedItem.Value & "'", cn)
Regards,
Iftikar
Aman Jen136 reputationPosted Jul 7, 2013, 5:06 AM EDT
here' my table
------------------------------------------------------------------
P_id P_Name
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 7, 2013, 5:21 AM EDT
Dim data As String
data=DropDownList1.SelectedItem.Value
Dim sqlcmd As New SqlCommand("select P_id,P_Name From DP_Table Where P_id = '" & DropDownList1.SelectedItem.Value & "'", cn)
Regards,
Iftikar
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 7, 2013, 5:26 AM EDT
call this method only first time when page load like below
If IsPostBack=false
bindDp()
-2)----------Retriveing data code (no need to hit your sql query again)
TB1.Text =DropDownList1.SelectedItem.Value
TB2.Text =DropDownList1.SelectedItem.Text
Regards,
Aman Jen136 reputationPosted Jul 7, 2013, 6:12 AM EDT
bit modified but still not working
Aman Jen136 reputationPosted Jul 7, 2013, 8:26 PM EDT