473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

null character evaluation ?

How do I test for null characters from a database query ??

Thanks,

Steve
Nov 18 '05 #1
4 1318
Use DBNull

"Steve Caliendo" <sc*******@epion.com> wrote in message
news:#w**************@TK2MSFTNGP10.phx.gbl...
How do I test for null characters from a database query ??

Thanks,

Steve

Nov 18 '05 #2
If Rs1.Item(0) = DBNull Then

I get the error that:

It is a type and cannot be used as an expression.

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:ew**************@TK2MSFTNGP11.phx.gbl...
Use DBNull

"Steve Caliendo" <sc*******@epion.com> wrote in message
news:#w**************@TK2MSFTNGP10.phx.gbl...
How do I test for null characters from a database query ??

Thanks,

Steve


Nov 18 '05 #3
Are you testing for a character with a scalar value of zero, or a null value
in a database column? If you want to test the value of characters, use the
string.Chars property. If you want to test if a column has a null value,
check if the value has a type of DBNull. If you're using a data reader, use
the IsDBNull method:

if(reader.Read())
{
int n = reader.IsDBNull(0)? 0: reader.GetInt32(0);
...
}

--
Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com

"Steve Caliendo" <sc*******@epion.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
How do I test for null characters from a database query ??

Thanks,

Steve

Nov 18 '05 #4
Sorry, DBNull is part of the SqlTypes namespace. It is an actual object in
the framework.

Althought I have not compiled this, try
If Rs1.Item(0) = System.Data.SqlTypes.DBNull Then ' Or whatever the
VB syntax might be.

"Steve Caliendo" <sc*******@epion.com> wrote in message
news:uN**************@tk2msftngp13.phx.gbl...
If Rs1.Item(0) = DBNull Then

I get the error that:

It is a type and cannot be used as an expression.

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:ew**************@TK2MSFTNGP11.phx.gbl...
Use DBNull

"Steve Caliendo" <sc*******@epion.com> wrote in message
news:#w**************@TK2MSFTNGP10.phx.gbl...
How do I test for null characters from a database query ??

Thanks,

Steve



Nov 18 '05 #5

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

Similar topics

2
by: Bryce Maschino | last post by:
hello, i'm working on a project searching through a list of arrays based on user input. the problem is that if a user does not define a certain variable, my if statement will not evaluate. i need...
9
by: MSUTech | last post by:
Hello, What is the best way to check each character within a string? For doing something like encryption, where you check character 1 and replace it with a different character.. then check...
9
by: ken | last post by:
Hi, I was wondering when you have an empty cell, its value is null in the debugger. So when you have an expression like this: "if len(mycell) < 1 then", or if you have "if mycell = null then" I...
1
by: A_StClaire_ | last post by:
hi, I have a singleton class called 'Evaluation' which is a utility class used to determine the strength of a poker hand. two members of 'Evaluation' are highCard and lowCard, two objects of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.