Common Mistakes

Chapter 5 - Reading Data using the Dataset Object
byJohn Kauffman, Fabio Claudio Ferracchiatiet al.?
Wrox Press ?2002

If you're having difficulty accessing the individual values within the columns of a table, you might like to use the following checklist to help identify your problem:

  • Note that there is no period between the row index and the name of the field: it's Rows(Index) ("FieldName"), not Rows(Index) . ("FieldName").

  • The names of the DataTable object and the field both need double quotes and parentheses.

  • All of the web server controls you're using (as well as the form, if present) must have the runat="server" attribute set.

  • Don't forget that the indexes of all collections - including the collection of items in a ListBox, and the collection of DataRow objects in a DataTable - are zero-based.

  • If you're attempting to retrieve a particular row based on a number returned from (say) a ListBox item, and there are gaps in the sequence of DataValues, then the ListBox. SelectedItem. Index numbers may not correspond to the correct row in the data source.



Beginning ASP. NET 2.0 and Databases
Beginning ASP.NET 2.0 and Databases (Wrox Beginning Guides)
ISBN: 0471781347
EAN: 2147483647
Year: 2004
Pages: 263

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net