Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8414027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:03:51+00:00 2026-06-10T01:03:51+00:00

When you want to determine if a database column is empty (i.e not null

  • 0

When you want to determine if a database column is empty (i.e not null but there is not any value in it) what are the differences between the below options:

customerRegion varchar(10) NULL is retrieved from the SQL database:

  1. If customerRegion = "" Then
  2. If customerRegion = Nothing Then
  3. If String.IsNullOrEmpty(customerRegion) Then
  4. If customerRegion Is Nothing Then

1,2,3 returns True 4 returns False when the column is empty.

Is 1 and 2 technically the same thing? and Why is 4 returning False?

Out of 1,2 and 3 which one should be used to determine if the column is empty (or is there any other way of doing it)?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T01:03:53+00:00Added an answer on June 10, 2026 at 1:03 am
    1. If customerRegion = "" Then – This tests to see if the column contains an empty (0 length) string. This is the “best” option because the value will never be Nothing. If the column value was null, it would equal DBNull, not Nothing.
    2. If customerRegion = Nothing Then – This is very confusing because many people will think it’s interchangeable with #4 (Is Nothing). When you test if a string equals Nothing, VB.NET automatically considers Nothing to be an empty string. That is why it evaluates to True.
    3. If String.IsNullOrEmpty(customerRegion) Then – This will work well, but it’s unnecessary since the column value will never be null (Nothing) (see #1).
    4. If customerRegion Is Nothing Then – This will never return true (see #1).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want that a column of my database, composed by float random numbers, change
I want to determine my curent position (latitude, longitude and altitude). In my database,
I'm trying to clean up a database and want to determine which tables are
I want to index a computed column in my database table which uses a
I have a ftp client that allows users to upload files. I want determine
I want to determine which part of audio file contain speech or music. I
I want to determine the screen resolution of the client machine and the set
I want to determine the scroll of the users. I'm using jQuery.. And jquery
I want to determine if a generic object type (T) method type parameter is
I want to determine the following QoS Attribute of my service: Response Time Reliability

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.