Hi,
I used to create views for such SQL query directly into my local SQL server.
Number "2" in bold is corresponding to the number of codes to filter for Code field. Table consist of a total of 7 fields.Code:SELECT [Claim No], [SAP Claim No] FROM [table1] WHERE [Claim no] IN ( SELECT [Claim no] FROM [table1] WHERE Code IN ('WTY_VS067', 'WTY_VS094') ) GROUP BY [Claim No], [SAP Claim No] HAVING COUNT([Claim No]) = 2
Before creating the view, I would have to trim 4 rows off a CSV file then import into a new table in my local SQL server.
These are too much of work, so I decided to code the program in VB.net 2010. Now that I have successfully read the CSV file and display them onto a DataGridView (bound to a datatable). With another ListView of carefully selected fields, user can choose the fields to filter their records (fields highlighted above in bold) accordingly.
Seeing that I have my data in Datatable and I guess there is no way to query a datatable records using pure SQL statement. I thought of resorting to using LINQ.
Please help with the LINQ statement in order to achieve the same result of the above SQL statement.
Thank you for any input.




Reply With Quote
