selecting data from view using datacontext
-
Hi, I am trying to retrieve data from a view (created as innerjoin from two tables) using linq. i have created a dbml (linq to sql file) and have added all my tables. i don't know how to add view and have no idea how i would retrieve information from a view using linq. Please provide help in this regard thanx, best regards
haseeb
-
Hi, I am trying to retrieve data from a view (created as innerjoin from two tables) using linq. i have created a dbml (linq to sql file) and have added all my tables. i don't know how to add view and have no idea how i would retrieve information from a view using linq. Please provide help in this regard thanx, best regards
haseeb
Hi, You can add a view like a normal table, and Query it in the same way: I added a view called View1, so visual studio creates me a class for it and do this: Dim query = From v In BD.View1s _ Select v.desc, v.day And it works... :)
-
Hi, You can add a view like a normal table, and Query it in the same way: I added a view called View1, so visual studio creates me a class for it and do this: Dim query = From v In BD.View1s _ Select v.desc, v.day And it works... :)
I tried it but it is not working like that , is there any problem with refreshing the dbml file coz i made that some time ago...
haseeb
-
Hi, You can add a view like a normal table, and Query it in the same way: I added a view called View1, so visual studio creates me a class for it and do this: Dim query = From v In BD.View1s _ Select v.desc, v.day And it works... :)
actually, another person made this dbml file ...he left the project and now i am assigned the project. I added this view coz i needed to select via inner join... now that i have made this view , i want to use it as he has used other tables.... would i have to add something manually for the view or not... how do i use this view as normal tables are used...thanx for helping
haseeb
-
actually, another person made this dbml file ...he left the project and now i am assigned the project. I added this view coz i needed to select via inner join... now that i have made this view , i want to use it as he has used other tables.... would i have to add something manually for the view or not... how do i use this view as normal tables are used...thanx for helping
haseeb
I think the only you have to do is drag and drop the view inside the DBML with the other tables. Have you tried in a new project with a new .dmbl? :suss:
-
Hi, I am trying to retrieve data from a view (created as innerjoin from two tables) using linq. i have created a dbml (linq to sql file) and have added all my tables. i don't know how to add view and have no idea how i would retrieve information from a view using linq. Please provide help in this regard thanx, best regards
haseeb
Hi haseeb, you can use the keyword join for inner join. For details check out at http://openreferals.com/blogs/post/How-to-use-LINQ.aspx[^]
-
Hi haseeb, you can use the keyword join for inner join. For details check out at http://openreferals.com/blogs/post/How-to-use-LINQ.aspx[^]
thanx it worked
haseeb
-
I think the only you have to do is drag and drop the view inside the DBML with the other tables. Have you tried in a new project with a new .dmbl? :suss:
it worked. thanx
haseeb
-
thanx it worked
haseeb
ur welcome.
-
Hi haseeb, you can use the keyword join for inner join. For details check out at http://openreferals.com/blogs/post/How-to-use-LINQ.aspx[^]