comparison error

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I am getting the 'Operator is not valid for type 'DBNull' and string "".'
error on the following line;

If (mydatatable.Rows.Item(I).Item("Forenames") Is System.DBNull.Value) Then
' 'I' is the loop variable from 0 To mydatatable.Rows.Count - 1.

Any ideas on what is the reason for this error?

Thanks

Regards
 
you may want to specify item().value. technically, if you return a column
named forenames then that "object" will have an instance...which is what it
looks like you're testing for. see if testing the column's value
helps...which is what i think you want anyway right?

hth,

steve


| Hi
|
| I am getting the 'Operator is not valid for type 'DBNull' and string "".'
| error on the following line;
|
| If (mydatatable.Rows.Item(I).Item("Forenames") Is System.DBNull.Value)
Then
| ' 'I' is the loop variable from 0 To mydatatable.Rows.Count - 1.
|
| Any ideas on what is the reason for this error?
|
| Thanks
|
| Regards
|
|
|
 
Hi John,

When I see your datatable it looks to me if it has this dimension
table
- Rows
-- Items
--- Items
I tought it was
- Rows
-- Items

The item exist but can be empty therefore it is not IS but =

So I think it has to be someting as

mydatatable.rows(i)("Forenames") = Dbnull.value

I hope this helps a little bit?

Cor
 
Back
Top