Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Check empty datarow

Posted on 2011-04-27
Medium Priority
Last Modified: 2012-06-21
How can I check to see if in datatable is empty while looping in datatable?

For I as integer = 0 to mydatatable.rows.count - 1


Question by:VBdotnet2005
  • 2
  • 2
LVL 10

Expert Comment

by:Asim Nazir
ID: 35481167
Here it's:

DataTable dt;

If(dt != null and dt.Rows.Count>0)
// Process. Looping etc.

Author Comment

ID: 35485065
sorry, I meant to skip an empty row.
What I am trying to do is to loop through datatable. If any rows that is empty, then skip reading it.

Author Comment

ID: 35485082
the entry row.
LVL 10

Accepted Solution

Asim Nazir earned 2000 total points
ID: 35486124
checking datarow for Empty can only be done by checking all the Row cell values.
Say you have 3 cells in a datarow. You can check cell 1 as follows:

if(Datatable.Rows[0][0] != null)
// process here

you can check other cels using AND in above if stmt.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

564 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