Trapping nulls for SequetialAccess

J

jonefer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top