Hi,
At the moment I use code like the following:
string myString = this.dataReader.IsDBNull(2) ? null :
this.dataReader.GetString(2);
With a record from the DB that looks like:
..---------------------------.
| id | name | email | phone |
'---------------------------'
In this example I am getting the value of the "email" column, but this
can get quite complicated, especially if I want to retrieve more columns
from the database, so that for example the record now looks like:
..-----------------------------------.
| id | name | title | email | phone |
'-----------------------------------'
Now the "email" column is at index 3 rather than 2, so my code is now
broken.
So what I want to be able to do is using code like:
string myString = this.dataReader.IsDBNull("email") ? null :
this.dataReader.GetString("email");
Obviously this is just pseudo-code and it doesn't work that way, but
something similar would be great.
Any ideas?
--
Dylan Parry - http://webpageworkshop.co.uk
A Flower?