[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Datatable check if exists

Posted on 2009-07-15
3
Medium Priority
?
524 Views
Last Modified: 2012-05-07
How can I check if a datatable exists - am trying to use the below but fails when the table is empty

                if (ds.Tables[2].Rows.Count > 0)
In c#
0
Comment
Question by:tbaseflug
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Expert Comment

by:p_davis
ID: 24860315
are you sure that ds.Tables[2] is there

check for

ds.Tables[2] == null
0
 
LVL 15

Accepted Solution

by:
jinal earned 2000 total points
ID: 24860334
if(ds.Tables.Count > 2)
{
if(ds.Tables[2] != null && ds.Tables[2].Rows.Count > 0)
{
}
}
0
 
LVL 22

Expert Comment

by:p_davis
ID: 24860810
so just b/c i didn't layout the entire code i get stiffed.

rock on.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how the fundamental information of how to create a table.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question