DataTable value not reflecting after some loop in C#

Gani_tpt 2,026 Reputation points

I am using for loop and it's looping number of ".mdb".

certain period of loop, i am getting null values in Data Table.

If we say exactly, after 19th count (0-19), 20 loop values will becoming in null values in Data Table.

How it does come and what will be the reason.

below is my code.

String EmpNo = String.Empty;
for (int i = 0; i < LISTmdb.Items.Count; i++) // More than 100 mdb
    EmpNo = GetEmpDetail(ds, mdbPath);

public static int GetEmpDetail(DataSet ds, string mdbName)
    string tblename = "EMP_SUMMARY";
    DataTable tblRes = ds.Tables[tblename]; // After 20th count, "tblRes" will be showing as null...?

but, In our MDB data's will be there always and this has been checked.

why it's getting null value in DataTable "tblRes" after exactly 20th count.....
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,482 questions
{count} votes