-
Oct 4th, 2012, 09:48 PM
#1
Thread Starter
Hyperactive Member
LINQ statement for given SQL query
Hi,
I used to create views for such SQL query directly into my local SQL server.
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
Number "2" in bold is corresponding to the number of codes to filter for Code field. Table consist of a total of 7 fields.
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.
-
Oct 5th, 2012, 08:24 AM
#2
Thread Starter
Hyperactive Member
Re: LINQ statement for given SQL query
Can I bump this without posting a reply?
Anyone can help me?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|