Datatable returns 0 rows when consuming data from Object Variable (Recordset)
       

This is crazy! I have a variable called ValidISBN and InvalidISBN (both Type Object). I have a Recordset that populates these variables in a data flow and I can see that the records comes in when look at the dataview.

ISSUE: When I fill the datatable, then count the rows, it returns 0?

Here is my code:

OleDbDataAdapter adapter = new OleDbDataAdapter();
DataTable ValidISBNDT = new DataTable();
DataTable InvalidISBNDT = new DataTable();

adapter.Fill(ValidISBNDT, Dts.Variables["User::ValidISBNTable"].Value);
adapter.Fill(InvalidISBNDT, Dts.Variables["User::InValidISBNTable"].Value);

Dts.Variables["User::ValidISBNTable"].Value = ValidISBNDT;
Dts.Variables["User::InvalidISBNTable"].Value = InvalidISBNDT;

string test = "";

test = (ValidISBNDT.Rows.Count.ToString());
MessageBox.Show(test);

test = (InvalidISBNDT.Rows.Count.ToString());
MessageBox.Show(test);

Thanks in advance!

March 26th, 2015 2:35pm

This is an odd way of populating the recodset which can be set to destination.

The code seems not to just able to fill an adapter off a package variable

Free Windows Admin Tool Kit Click here and download it now
March 26th, 2015 3:37pm

Hi Arthur,

Once an object from a recordset fills a datatable it gets emptied so thats why I push it back into intself but this time as a datatable so that it be reuse throughout my package.

I was able to resolve my issue by creating a new package and coping all of the components over. Not sure what the issue was with the initial package but something went wonky on me.

  • Marked as answer by shawn_2020 10 hours 2 minutes ago
March 26th, 2015 5:05pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics