Need help with a sql view

I am using the following query:

SELECT        a.pkNewTargetID, a.ProductClass, a.Product_ProductServiceName
FROM            Target AS a LEFT OUTER JOIN
                         TargetReference AS b ON a.Product_ProductServiceName = b.ProductServiceName amd b.fk_PlanID='30'
WHERE        (b.ProductServiceName IS NULL) AND (a.Letter = 'Y')

This query is intended to show all records from target that are not in TargetReference that are assigned to that paticular fk_PlanID.  I can get the query to work in design view however when I put it into a view I cannot populate that '30' using a linqdatasource. Please help.
Who is Participating?
I take it the issue here is really about figuring out how to filter when using a LinqDataSource. In general, you can filter the returned data to retrieve only the records that meet particular criteria by setting the LinqDataSource's Where property to the conditions that must be met for a record to be included in the returned data.

You can do this by parameterising the Where clause (to pick up values from controls automatially as shown under the "Creating a Parameterized Where Clause" section on this page If you want to do it programmatically... then see if this article helps:
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>b.ProductServiceName amd b.fk_PlanID='30'
typo, amd should be AND

should this be a.fk_PlanID?
mwhodgesAuthor Commented:
Yes sorry.  I made the correction after I posted.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.