9
Answers

populating data to dropdown list and text field from sql tab

Aman Jen

Aman Jen

11y
1k
1

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


Answers (9)