Aman Jen

Aman Jen

  • NA
  • 141
  • 40.6k

populating data to dropdown list and text field from sql tab

Jul 7 2013 7:00 AM

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)