Hi,
Just going back to binding a datareader to either a textbox or label (in this case a label).
Can anyone see the problem with this code below. I have run the query in SQL and it brings me back a Ward Name but when I load the page I get an error stating that there is No data exists for the row/column. I also manually set the criteria for the query and still get the same error.
Code:
Dim cmdWardName As New Odbc.OdbcCommand("SELECT WARDNAME, WARDCODE FROM ASSETDDH.WARDS5 WHERE WARDCODE =" & "'" & strWardCode & "'", cnBarwickPas)
cnBarwickPas.Open()
Dim drWardName As Odbc.OdbcDataReader
drWardName = cmdWardName.ExecuteReader()
lblWardName.Text = drWardName("WARDNAME")
lblWardName.DataBind()
drWardName.Close()
cnBarwickPas.Close()
Any ideas would be gratful.
Thanks