Here's what I did ... who knows if it's efficient. After working on it all afternoon, I'm glad it works:
- Select the list to be excluded
- convert the collection to an array of objects
- pass the array to the new collection selection as an array attached to the NotIN.
You may have to stumble through the variables ... it's not Northwind
// Populate the Binding Sources for the related Tabs
// Retrieve Bindings for the LZone SubScription tab
// first the lookup
// Get the exclude list
OrionDB.LZLinkCollection nlzcol = new InlineQuery().
ExecuteAsCollection<OrionDB.LZLinkCollection>("SELECT LZoneNum from dbo.LZLinks WHERE Device = @DeviceID", DevItem);
BindingSource LZluBinding = new BindingSource();
//nlzcol contains the Zones already subscribed
object[] lzsubs = new object[nlzcol.Count];
int i = 0;
foreach (object o in nlzcol)
{
lzsubs = nlzcol.LZoneNum;
i++;
}
Orion.LZoneCollection lzc = Orion.DB.Select().From<Orion.LZone>().Where("LZoneNum").NotIn(lzsubs)
.ExecuteAsCollection<Orion.LZoneCollection>();
////This blows up look at it later
// List<LZLookup> lzlu = SPs.NotInLzonesForDevice(6)
// .ExecuteTypedList<LZLookup>();
LZluBinding.DataSource = lzc;
gvLZLookup.DataSource = LZluBinding;
//// Now The Data Table
gvLZSub.DataSource = LZoneBinding;
hth dan
If you're going to look back and laugh... You might as well laugh now!