StrataFrame Forum

Fill method to select all records where fk value not in a list of integers passed in

http://forum.strataframe.net/Topic24518.aspx

By Charles R Hankey - 9/3/2009

Actually, I want to fill a checkedlistbox which is getting its data directly from a fill method in the TemplatesBO.



Currently it is just doing a fillall()



(though I'd still like to know a how to of the previous BO / BO question )



Now, I have a PDFsBO that just represents selected records (same scenario as first question)



Now I want to write a fill method to fill the second checked listbox "Templates" so that no item comes from a record that has a pk matching an itemplateskey found in PDFsBO



I assume I need to pass in a list (or array?) of itemplateskeys found in pdfsBO.



But what is the "Select " statement for the fill that will select only records "where ikey not in (select itemplateskey from parameterarray)")






By Greg McGuffey - 9/4/2009

The brute force way is to build a list of PKs from the checked listbox that you then use in a select query.



'-- Build list of selected generated PDFs by

'   looping through selected items in checked list box

...



'-- Build Select

Dim selectSql = "Select * From Templates Where TemplateID Not In(" & selectedPks & ")"





Likely, you'd generate the list of selected PKs in the form and pass that list to a Fill method in the BO.



Hope that makes sense...
By Charles R Hankey - 9/4/2009

It does indeed and that is the direction I was headed before I heard the siren song of LINQ. I am going to mess with both approaches, as I'm sure each will come in handy at one time or another.



By Tuesday I may have LINQ chops to show you Smile (ordered a couple of books as I can see where LINQ to objects can be kind of cool. Beth Massey has a couple of nice aggregation examples on her blog)
By Edhy Rijo - 9/4/2009

Hi Charles,



Be aware that LINQ requires .NET 3.0 or 3.5, and there is a size difference between .NET 2.0 runtime and the newest one.
By Charles R Hankey - 9/4/2009

Thanks Eddy



I'm specing everything against 3.5 and SQL 2008. No reason to be backward compatible with anything.



Is the size of the run-time an issue?
By Trent L. Taylor - 9/7/2009

Is the size of the run-time an issue?

Not unless you have download or install limitations.  In most environments this should not be an issue.