Re: no data exists for the row/column



After the command returns you a DataReader, you have to read records from
database line by line:

....

objoledbdatareader = objoledbcommand.ExecuteReader

If objoledbdatareader.Read() Then
txtClient.Text = objoledbdatareader.Item("first_name")
End If

....


"bindurajeesh" <bindurajeesh@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F57FC87E-2C29-4446-8A82-A7359C53AC9B@xxxxxxxxxxxxxxxx
I run the following code:

objoledbcommand.Connection.Open()
strsql = "select first_name + ' ' + last_name as fullname from
tblperson where pers_entity_id = '" & ddlClient.SelectedValue & "'"
objoledbcommand.CommandText = strsql
objoledbdatareader = objoledbcommand.ExecuteReader
txtClient.Text = objoledbdatareader.Item("first_name")
objoledbcommand.Connection.Close()

and it errors on line "txtClient.Text =
objoledbdatareader.item("fullname")
with
no data exists for the row/column.

I ran the exact same query in query analyzer with the correct id in the
where clause and one record is found.

on debug the strsql has all the items it needs in where clause

Any wisdom?


.


Loading