I have a group of records in a set - usually 5-10 rows. For example
ProviderPanel would have several elements. I do this so I can handle the
formatting of each value on a case by case basis.

A typical scenario would be that before writing any records to either labels
or a class, I should try to 'trap' any possible nulls before trying to set
them to a variable.
This only works with SequentialAccess in a DataReader

So,

cn.Open()
dr = cmd.ExecuteReader(CommandBehavior.SequentialAccess)

Do While dr.Read
Select Case strGroupLevel
Case "PCP"
strMeasure = iif( dr("MeasureID") is DBNull.Value, "",
(dr("MeasureID")
lPerform = iif(isnumeric(dr("Perform"), dr("Perform"),0)
Case "......."
End Select

But if I do this --- I get the ordinal error - "Tryinng to read from ordinal
1 ...etc.

I suppose this is because I am doing a 'double-take' on the column with my
IIF statment? And it can't read it because it's on to the next column
already?

Anyhow, how can I go about trapping nulls if I use SequentialAccess in a
Reader.

Re: Trapping nulls for SequetialAccess by Cor

Cor
Wed Apr 23 23:05:45 CDT 2008

Jonefer,

I never use the IIF in VB, but I know that with VB everything will be
evaluated, so in this case can that be the reason of your problem.

However very good hidden is the isdbnull property on MSDN.

http://msdn2.microsoft.com/en-us/library/system.data.idatarecord.isdbnull(VS.71).aspx

Cor