LinqDataSource找不到任何datacontext对象 [英] LinqDataSource cannot find any datacontext objects

查看:529
本文介绍了LinqDataSource找不到任何datacontext对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在尝试一些新的基于LINQ的编程。我创建了一个LINQ to SQL类,我通过将表格从服务器资源管理器直接拖到O / R设计器上来创建它。保存,并尝试在LINQDataSource中使用它,并且linqdatasource向导在我尝试配置它时找不到任何datacontext对象。我一直在关注这里发布的例子

http://blogs.msdn.com/charlie/archive/2007/11/19/connect-to-a-sql-database-and-use-the -sql-designer.aspx

而不是使用northwind,我使用的是我自己的sql表,这与我在网上搜索的时间里找不到任何差别。问题。

任何想法都会非常感激。

干杯,
布伦特

Hello all,
I am attempting some new LINQ based programming.  I have a LINQ to SQL class created and I created it by dragging the table form the server explorer directly onto the O/R designer.  Saved that, and attempted to use it in a LINQDataSource and the linqdatasource wizard cannot locate any datacontext objects when I try to configure it.  I have been following the example as posted here

http://blogs.msdn.com/charlie/archive/2007/11/19/connect-to-a-sql-database-and-use-the-sql-designer.aspx

but rather than using northwind, I am using my own sql table which should not make any difference from what I have been able find from the hours that I have been searching the net on this problem.

Any ideas would be greatly apprecieated.

Cheers,
Brent

推荐答案

您好

从服务器资源管理器中拖动表格时进入datacontex保存datacontext并构建您的项目。如果你仍然有这个问题重新启动,请考虑当你在数据库中更改表时,你必须从datacontext中删除该表并关闭它aftar,刷新你在服务器资源管理器中的数据库连接,然后将该表拖入datacontext.be考虑更改后的datacontex会重新生成。

when you drag a table from server explorer into datacontex save datacontext and build your project . if you have still this problem restart vs. be consider that when you change your table in database you have to remove that table from datacontext and close it aftar that refresh your connnection to database in server explorer and then drag that table into datacontext.be consider that datacontex after change become regenerated.

请原谅我的英语不好。

我希望这很有用。


这篇关于LinqDataSource找不到任何datacontext对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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