473,748 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

comparison error

Hi

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

If (mydatatable.Ro ws.Item(I).Item ("Forenames" ) Is System.DBNull.V alue) Then
' 'I' is the loop variable from 0 To mydatatable.Row s.Count - 1.

Any ideas on what is the reason for this error?

Thanks

Regards

Nov 20 '05 #1
2 1157
you may want to specify item().value. technically, if you return a column
named forenames then that "object" will have an instance...whic h 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.in fovis.co.uk> wrote in message
news:eT******** ******@tk2msftn gp13.phx.gbl...
| Hi
|
| I am getting the 'Operator is not valid for type 'DBNull' and string "".'
| error on the following line;
|
| If (mydatatable.Ro ws.Item(I).Item ("Forenames" ) Is System.DBNull.V alue)
Then
| ' 'I' is the loop variable from 0 To mydatatable.Row s.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.row s(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.Ro ws.Item(I).Item ("Forenames" ) Is System.DBNull.V alue) Then ' 'I' is the loop variable from 0 To mydatatable.Row s.Count - 1.

Any ideas on what is the reason for this error?

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1973
by: sam | last post by:
Hi, I got the the following syntax error in comparison: File "/usr/local/work/myparser.py", line 85 if ( (m=self.macro_parser.match (d)) != None ): ^ SyntaxError: invalid syntax How can I get around wtih this? I don't want to break down this comparison in two steps.
46
5161
by: yadurajj | last post by:
Hello i am newbie trying to learn C..I need to know about string comparisons in C, without using a library function,...recently I was asked this in an interview..I can write a small program but I was told that wouldn't it be wise to first get the length of the strings..if it doesn't match then they are not the same..I agreed...then he said..but again that would be an overhead first measuring the length...and then doing a character by...
14
2399
by: Santi | last post by:
I see in some code, I don´t remember now if it is c# or c++, that the when they perform a comparison they use the value first and then the variable, like: if( null == variable ){} Is there an explanation for this or is it the same as doing the usual variable == value? -- Santi
37
2809
by: spam.noam | last post by:
Hello, Guido has decided, in python-dev, that in Py3K the id-based order comparisons will be dropped. This means that, for example, "{} < " will raise a TypeError instead of the current behaviour, which is returning a value which is, really, id({}) < id(). He also said that default equality comparison will continue to be identity-based. This means that x == y will never raise an exception, as is the situation is now. Here's his reason:
1
1570
by: bjjnova | last post by:
I have the following string comparison that is throwing an error I cannot find ( I will include my attempts to trace the error) In the line following the asterisks, written as I have below, a true is always returned and the printed msg appears that the 2 variables are not equal. This happens even when the print statement writes out, "Change Doc Types TASK and TASK are not equal". (So, even when I test each variable separately and it...
5
3905
by: fade | last post by:
Good afternoon, I need some advice on the following: I've got a class that has a member std::vector<CStringm_vFileName and a member CString m_path; The vector contains a bunch of filenames with no path included (no C:\...) eg: my_file2.jpg, my_file1.bmp, etc... and m_path stores the path, eg: C:\folder1 I want to sort this vector according to different criterion, such as
4
6553
by: metalinc | last post by:
hi...im new to C programming...need help...tried to run this code but got this error fork.c: In function ‘parse’: fork.c:44: warning: comparison between pointer and integer fork.c:51: warning: assignment makes integer from pointer without a cast fork.c:61: warning: comparison between pointer and integer /tmp/cciECfg4.o: In function `main': fork.c:(.text+0x3a): warning: the `gets' function is dangerous and should not be used. #include...
20
12438
by: chutsu | last post by:
I'm trying to compare between pointer and integer in an "IF" statement how do I make this work? if(patient.id != NULL){ } Thanks Chris
5
695
by: evanevankan2 | last post by:
I have a question about the warning 'comparison between signed and unsigned' I get from my code. It comes from the conditional in the outer for loop. I understand the warning, but I'm not sure what is the best way to prevent it. I can just change i to a type size_t or maybe put a cast in the conditional, but I don't know which way that is 'best'? Any ideas? I provided the code below for some context. And while we're at it, could you...
2
3032
by: puzzlecracker | last post by:
Unlike C++, in Csharp you're only allowed to compare a generic type T with null, if the method it's passed in not implementing IComparable<Tor , IEquatable<T(still don't know why we need these two radically similar interfaces). In other words, Csharp enforces people to not make mistake, whereas C++ follows the philosophy "if you make a stupid mistake, pay for it, and in the future you won't do it again." In my opinion, comparing a type...
0
9363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9238
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.