473,322 Members | 1,401 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,322 software developers and data experts.

Detect a NULL string

How can I detect a NULL string using C# ?
Thanks.

Nov 18 '05 #1
5 1479
John Smith wrote:
How can I detect a NULL string using C# ?
Thanks.


Not sure what you mean by a null string so just in case, here's two
options:

Null: if (myString == null)
Empty: if (myString == "")

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 18 '05 #2
Are you trying to test onde columns returned from database?
You can use the function isDbNUll(FIELD)
Steven Alexander
-----Original Message-----
How can I detect a NULL string using C# ?
Thanks.

.

Nov 18 '05 #3
Null string, as in char(0) or a string that is null:

if(stringName == null)
{
// you detected a null string
}

char[] charArray = stringName.ToCharArray();

//Assume only one char if it is a null char
if(charArray[0] == 0)
{
// only a null char
}

I am flying by the seat of my pants here, so you may have to alter the code
to get past debug. The theory is sound, however.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"John Smith" <me@privacy.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
How can I detect a NULL string using C# ?
Thanks.

Nov 18 '05 #4
> >How can I detect a NULL string using C# ?

if you mean an empty string.

if( aString == string.empty )
Nov 18 '05 #5
This is the one I looking for: if (myString == null).
Thanks.
Q

Frank Oquendo wrote:
John Smith wrote:
How can I detect a NULL string using C# ?
Thanks.

Not sure what you mean by a null string so just in case, here's two
options:

Null: if (myString == null)
Empty: if (myString == "")


Nov 18 '05 #6

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

Similar topics

1
by: James A | last post by:
A particular item in my listbox is null. The field is of type currency. I'm running Access 2000 - SP3 When I use the Isnull(orderitems.column(12,12)) it does not detect it. Also, if i use...
2
by: John Lee | last post by:
Hi, I have few questions related to .NET 2.0 TransactionScope class behavior: 1. Check Transaction.Current.TransactionInformation.DistributedIdentifier to identify if distributed transaction...
2
by: xoinki | last post by:
Hi all, I have this sample data in a .txt file, -- Ne doit pas faire -- é select PARC.CONTYP , PARC.CONSTA , count(*) from ParcNonCede PARC
1
by: Someone21 | last post by:
Hi all, I am currently trying to retrieve a string from a textfile, separate that and put it in an array. I stumbled on the problem that *token is a pointer, and not the string. However when i...
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...
0
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...
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.