|
-
Jul 24th, 2008, 02:20 PM
#1
Thread Starter
New Member
Parameter column in LINQ
Hi, people!
Can I use LINQ with parameters?
For example, in SQL it´s possible:
SELECT @colum1, @colum2
from @table
Someone know´s that is possible to do the same thing in LINQ?
I tried to do, like this:
Dim db As New ReceitaDataContext
Dim command = From cla In bd.???? _
Select cla.????, cla.????
DataGridView.DataSource = Command.ToList
-
Jul 24th, 2008, 03:27 PM
#2
Re: Parameter column in LINQ
No, as far as I know, you can't use LINQ in that fashion. There's ways around that though. What kind of structures are bd and cla? I can write you up an example if I knew more about them.
-
Jul 24th, 2008, 08:34 PM
#3
Thread Starter
New Member
Re: Parameter column in LINQ
Hi Jenner!
First of all, thank´s!
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:
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:
Dim qr = From pro In db.@parameter_table _
Where pro.@parameter_column = 1 _
Select pro.column1, pro.column2
It´s is possible?
Thank´s
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
|