ricardoleme
New member
- Joined
- Jul 27, 2008
- Messages
- 1
- Programming Experience
- 1-3
Hi People!
Can I use LINQ with parameters?
For example, in SQL it´s possible:
Let´s me see one example using Northwind Database
I have created one Linq to SQL Classe and put all the tables of Northwind like Region, Products and Customers.
I´m trying to do something like this:
If i use this form, it´s ok. But I´m interested in create one query with LINQ like this:
It´s is possible?
Thank´s
Can I use LINQ with parameters?
For example, in SQL it´s possible:
VB.NET:
SELECT @colum1, @colum2
from @table
I have created one Linq to SQL Classe and put all the tables of Northwind like Region, Products and Customers.
I´m trying to do something like this:
VB.NET:
Public Function createquery()
Dim db As New NorthWindLINQDataContext
Dim qr = From pro In db.Products _
Where pro.ProductID = 1 _
Select pro.ProductID, pro.ProductName
Return qr.ToList
End Function
If i use this form, it´s ok. But I´m interested in create one query with LINQ like this:
VB.NET:
Dim qr = From pro In db.@parameter_table _
Where pro.@parameter_column = 1 _
Select pro.column1, pro.column2
It´s is possible?
Thank´s
Last edited by a moderator: