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 HussainPosted Jul 7, 2013, 1:06 PM
Regards,
Iftikar
Aman JenPosted Jul 8, 2013, 12:26 AM
Aman JenPosted Jul 7, 2013, 10:12 AM
bit modified but still not working
Iftikar HussainPosted Jul 7, 2013, 9:26 AM
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,
Iftikar HussainPosted Jul 7, 2013, 9:21 AM
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
Aman JenPosted Jul 7, 2013, 9:06 AM
here' my table
------------------------------------------------------------------
P_id P_Name
Iftikar HussainPosted Jul 7, 2013, 8:48 AM
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 JenPosted Jul 7, 2013, 8:39 AM
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 HussainPosted Jul 7, 2013, 8:17 AM