By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,453 Members | 961 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,453 IT Pros & Developers. It's quick & easy.

comparison error

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.