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

  • SEARCH
  • Home
  • 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 7624559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:59:43+00:00 2026-05-31T04:59:43+00:00

Goodday I can’t seem to use my dataset in a Null comparison I’m trying

  • 0

Goodday

I can’t seem to use my dataset in a Null comparison
I’m trying to make an statement (attempts go below) where it will only continue my code when my dataset is empty.

Code 1:

if ((string)dts.Tables[0].Rows[0]["RECID"] != null)

^ just skips my if, I know that it’s empty (checked my watch), still continues even when it is null.

Code 2:

 long Recid = 0;
 Boolean checkrecid = long.TryParse((string)dts.Tables[0].Rows[0]["RECID"], out Recid);
 if (checkrecid == false)

^ Crashes at my Tryparse. I know you can use Trycatching, but I don’t want to use it, cause it will make my program run slower, and it needs to read a good 10000 lines a day …

Error:

A first chance exception of type 'System.IndexOutOfRangeException' occurred in System.Data.dll

Meaning that it can’t find anything, but I know that already.

EDIT: I do not want an error. Any previous methods, who all work in other cases, return an indexoutofrange error. I’ll add this ..
The dataset is filled with data from an SQL server based on phonenumbers and other data.
If he can’t find the phonenumber, which comes from a text file, he will return nothing, no row, no column, nothing.

Thanks in advance,
DZ

  • 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-05-31T04:59:45+00:00Added an answer on May 31, 2026 at 4:59 am

    Found it!

    int strTables = dts.Tables[0].Rows.Count;
    if (strTables == 1){ //code goes here}

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Goodday, I use the below code to start a timer . Label2.Text = Difference1.TotalMinutes.ToString(N0)
Good Day Everyone, I'm currently trying to write a routine that will examine a
Good day, Can I ask, what if I subscribe to Azure with only Virtual
Good day, i will try to explain my problem as best as i can.
Goodday everybody, So I made a class Temperature, which has a constructor to make
Good day, can't seem to find a solution for this. i have 2 buttons
Good day, i am having troubles with the following image below. As you can
Good day, I have this problem with Html.DropDownListFor which I can't seem to work
Good day, Im wondering if we can use keyboard shortcut F2 and F3 to
Good day, I was wondering if it is possible to use an INSERT-OUTPUT statement

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.