Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Null Values in Datatable - VB.Net

Posted on 2016-08-07
3
Medium Priority
?
103 Views
Last Modified: 2016-08-09
Hello everyone,
So I am getting a weird anomaly while using a datatable in vb.net. Every so often I get nulls in my datatable where they do not exist in SQL. I know "how" to compensate for them, but that isn't my issue, they should not be there, and it just makes the integrity of results bad..

I am using the following code to populate the table
            Try
                Using Processing_LoadData As New SqlDataAdapter("SELECT [TrackingID],[SAMAccountName],[DisplayName],[givenName],[middleName],[sn],[employeeNumber],[employeeID],[EmployeeType],[Personal_Phone],[Personal_EMail],[roomNumber],[accountExpires],[Creator],[Location_Friendly],[LocationID],[Building_DN],[Address1],[Address2],[City],[State],[Zip],[Description],[Office],[Department],[Company],[ProfilePath],[HomePath],[HomeDrive],[Record_Source],[INSERT_TIME],[MailTO],[Auto_Expiration_Enable],[Auto_Expiration_Int],[Auto_Expiration_Peroid],[IP],[Justification],[141],[ADDN],[Mail],[Live_Object_Source] FROM [AMSv1].[dbo].[AMS_Processing_INPROGRESS_ADWrite];", Processing_SQLConnection)
                    Try
                        Processing_DataResults = New DataTable
                        Processing_LoadData.Fill(Processing_DataResults)
                    Catch ex As Exception
                        WinEventLog.WriteEntry("Account Processing: Failed to populate datatable. " & ex.ToString, EventLogEntryType.Warning, 1503)
                        GoTo Processing_Exit
                    End Try
                End Using
            Catch ex As Exception
                WinEventLog.WriteEntry("Account Processing: Failed to bind to SQL", EventLogEntryType.Warning, 1502)
                GoTo Processing_Exit
            End Try

Open in new window


Reason I am using a database instead of direct SQL reads is because I am spinning up multiple threads to process the changes in parallel. and using a datatable you can easily divide up the load.

executing the same statement in sql, I have no nulls.

Has anyone else had this problem / seen this?
I am not going to lie, it is a LOT of data, 40 columns and between 9,000 to 150,000 rows.
0
Comment
Question by:JesNoFear
[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 9

Accepted Solution

by:
Trideep Patel earned 2000 total points
ID: 41746673
Have you put a break point and checked that Processing_DataResults contains null values after Processing_LoadData.Fill(Processing_DataResults) line?
I am just asking it because it might be possible due to parallel for loop or threading.
1
 
LVL 2

Author Comment

by:JesNoFear
ID: 41748008
So, directly after this is when the loop's start. it does the load and then spins up the multi-threads.

So, what i have done since this post was in each thread, it is given a range of rows to process, as it goes through the for next loop, i have it checking all the fields for nulls, if it finds a null that is unexpected, it will drop that job and use a continue for and denote in sql to re-process that entry after the cycle is done.

and with that being said, since that change, neither the safeguard check before it does the work or while the work is being done have null's come up. i added a break point if it were to find a null, as well as logging it to windows even log.

so it is still a mystery, i have been flooding it with sets of 9,000 and 15,000 transactions all day. I am about to do another load test with 150,000 transactions and see if it comes back or not, and/or that the safeguard is working.
0
 
LVL 2

Author Closing Comment

by:JesNoFear
ID: 41749507
the issue has disappeared since i added the pre-checking.
0

Featured Post

Docker-Compose to Simplify Multi-Container Builds

Our veteran DevOps Author takes you through how to build a multi-container environment, managed with a single utility in order to simplify your deployments.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

705 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