472,129 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,129 software developers and data experts.

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 1079
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.