|
Joel, In the .NET and Java worlds you don't want to rely on the ordinal position of columns and untyped data. Using column names is better but pushes the problem into your application and is similar to using program-described files in RPG. A better solution is to use a mapping or ORM tool along with a strongly-typed DataSet in the .NET world or class Collections in Java. That way you get compile-time feedback when things change and also centralizes your data definition. David Morris >>> jrc@xxxxxxxxxx 06/10/05 9:55 AM >>> ... DataTable dt = myDataSet.Tables[ "TABLENAME" ]; int employeeOrdinal = dt.Columns[ "EMPNUM" ].Ordinal ; Or if you are using a DataReader: int employeeOrdinal = reader.GetOrdinal[ "EMPNUM" ]; Yes, you have to use the field name, but you do not have to hardcode the Ordinal values, so if the field order changes you are still covered. If you changed a field name in a file, RPG would bomb at run-time as well. Yes, if you recompile it, RPG would catch it and .NET wouldn't, but this is also true of Java, C, C++, Perl, Python, PHP, and you-name-it-other-than-RPG. ... Joel Cochran
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.