469,623 Members | 1,422 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

comparison error

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

Nov 20 '05 #1
2 1011
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
"John" <jo**@nospam.infovis.co.uk> wrote in message
news:eT**************@tk2msftngp13.phx.gbl...
| 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
|
|
|
Nov 20 '05 #2
Cor
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
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?

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by sam | last post: by
46 posts views Thread by yadurajj | last post: by
14 posts views Thread by Santi | last post: by
37 posts views Thread by spam.noam | last post: by
1 post views Thread by bjjnova | last post: by
5 posts views Thread by fade | last post: by
20 posts views Thread by chutsu | last post: by
5 posts views Thread by evanevankan2 | last post: by
2 posts views Thread by puzzlecracker | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.