This is the error i get "Object reference not set to an instance of an object. "
when i try the pc of code below. I get the error at this line"Dim dr As Data.DataRow = ds.Tables("countries").NewRow"
Dim con As New SqlConnection(Application("connection"))
Dim sql As String = "select * from countries"
Dim ds As New DataSet
Dim da As New SqlDataAdapter(sql, con)
da.Fill(ds)
Dim test As String = ds.GetXml
Dim dr As Data.DataRow = ds.Tables("countries").NewRow
dr.Item("country") = "---Please select a country---"
ds.Tables("countriesy").Rows.InsertAt(dr, 0)
Me.ddlcountry.DataSource = ds
Me.ddlcountry.DataTextField = "country"
Me.ddlcountry.DataValueField = "country_id"
Me.ddlcountry.DataBind()
ds = Nothing
Thanks for your help
when i try the pc of code below. I get the error at this line"Dim dr As Data.DataRow = ds.Tables("countries").NewRow"
Dim con As New SqlConnection(Application("connection"))
Dim sql As String = "select * from countries"
Dim ds As New DataSet
Dim da As New SqlDataAdapter(sql, con)
da.Fill(ds)
Dim test As String = ds.GetXml
Dim dr As Data.DataRow = ds.Tables("countries").NewRow
dr.Item("country") = "---Please select a country---"
ds.Tables("countriesy").Rows.InsertAt(dr, 0)
Me.ddlcountry.DataSource = ds
Me.ddlcountry.DataTextField = "country"
Me.ddlcountry.DataValueField = "country_id"
Me.ddlcountry.DataBind()
ds = Nothing
Thanks for your help