使用LinqDataSource - 查询多个表? [英] LINQDataSource - Query Multiple Tables?

查看:627
本文介绍了使用LinqDataSource - 查询多个表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据库,我创建了一个DBML LINQ到SQL文件重新present这个数据库。我创建了一个新的aspx页面,并放弃了使用LinqDataSource和FormView控件到它。当我配置的LinqDataSource它只是让我选择从一个表中选择* ... ...但我想从多个表拉。例如我有这样simple_person,simple_address,simple_phone表,我想从所有的人拉。我怎样才能做到这一点?

I have a database and I've created a DBML Linq-to-SQL file to represent this database. I've created a new aspx page and dropped a linqdatasource and a formview control onto it. When I configure the linqdatasource it gives me the choice only to select * from one table...but I want to pull from multiple tables. e.g. I have tables like simple_person, simple_address, simple_phone, and I want to pull from all of them. How can I accomplish this?

推荐答案

使用自定义查询

<一个href=\"http://weblogs.asp.net/scottgu/archive/2007/09/07/linq-to-sql-part-9-using-a-custom-linq-ex$p$pssion-with-the-lt-asp-linqdatasource-gt-control.aspx\">http://weblogs.asp.net/scottgu/archive/2007/09/07/linq-to-sql-part-9-using-a-custom-linq-ex$p$pssion-with-the-lt-asp-linqdatasource-gt-control.aspx

See: Using the <asp:LinqDataSource> Selecting Event

这篇关于使用LinqDataSource - 查询多个表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆