I'm using Linq to SQL in C# to check for conditions based on tables in separate databases. In the end, I need to compare an order list against the order list in the data warehouse to make sure everything matches.
// (Database 1) - Pull list of invalid customer types and statuses
//This selects invalid customers types we need to exclude from our results
CustomersDBDataContext Customers = new CustomersDBDataContext();
List<int> validCustomerTypes = new List<int> { 1, 9, 10 };
var customersToExclude = from w in oecMainCompanyIDs.CompanyTypes
where !validCompanyTypes.Contains(w.CompanyTypeID) &&
w.StatusID != 1
select w.customerID;
List<string> negList = Customers.ToList<string>();
// (Database 2) - Pull list from customer / order ID table
CustOrdDataContext orgKeys = new CustOrdDataContext();
var CustomerOrderResults = from v in orgKeys.MemberOrganizations
let customerID = v.customerKey.Substring(0, 10)
let orderID = v.OrdID
select new { customerID, orderID };
I need to build a list of OrderIDs from CustomerOrderResults from (Database 2), which excludes invalid customer types and status IDs from (Database 1). Any guidance on this?
....
eventually, I will return the values from this and compare them against the list in the datawarehouse.
// DataWarehouse (Database 3)
OrdersDBDataContext Orders = new OrdersDBDataContext();
var OrderList = from u in Orders.OrderTable
select u.orderNumbers;
List<string> orderList = Orders.ToList<string>();
.. In The End, I want to compare my orderlist from Database one minus invalid records from database two to my list of orders from database three
CollectionAssert.AreEqual(expected, orderList);
...........
When I tried a list from the results (which is several thousand records), I received this this message at runtime "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Too many parameters were provided in this RPC request. The maximum is 2100."
I wound up feeding them in separately, then sorting them this way.
foreach (var x in rawOECResultsString)
{
if (oecMainNegativeResults.Contains(x.companyID) == false)
filteredOECResults.Add(x.orgID);
}
See any other way to handle it?