Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to display text from datareader field
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00672730
Message ID:
00672732
Vues:
8
This message has been marked as the solution to the initial question of the thread.
You need to call the Read method of the DataReader before accessing the data. The Read method actually goes out and fetches the record. Change your code to the following:

Dim reader As System.Data.OleDb.OleDbDataReader
reader = OleDbCommand1.ExecuteReader()
reader.Read()
TextBox4.Text() = reader.Item("hdesc")


>I am trying to display a datareader field value in a text box on an ASP.Net form. Keep getting error "No data exists for the row/column." when it tries to execute the last line of code below. If I add a datagrid to the form and bind it to the reader it displays the data correctly so I know its there. YYYAAAHHHH!
>
>Dim reader As System.Data.OleDb.OleDbDataReader
>reader = OleDbCommand1.ExecuteReader()
>TextBox4.Text() = reader.Item("hdesc")
>
>Any input would be greatly appreciated...
>
>Todd
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform