使用表适配器 [英] Working with Table Adapter

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

问题描述

大家好,

我正在建立我的新网站,这是我的第一个网站,对编程我不太了解.

我试图搜索3层体系结构,并试图编写我的DAL,并发现了一个叫做表适配器"的表.
我创建了一个pubs.xsd并查看了一些我可以配置的链接,但是问题是他们在页面加载事件中编写了以下代码.

Hello Guys,

I am building my new website, which is my first web site, and I don''t know much about programming.

I was trying to search for 3 tier architecture and was trying to write my DAL and found out something called Table Adapter.
I created a pubs.xsd and looking at some links I was able to configure it, but the problem is they wrote the following code in the page load event.

PubsTableAdapters.authorsTableAdapter myadapter = new PubsTableAdapters.authorsTableAdapter();
        Pubs.authorsDataTable myauthors;
        myauthors = myadapter.GetAuthors();
        foreach(Pubs.authorsRow authorrow in myauthors)
        Response.Write("Author: " + authorrow.au_fname + "  " + authorrow.au_lname+  "<br />");



这行代码给我一个错误,提示您缺少引用或程序集或名称空间.

这是我关注的链接:

http ://dotnetstories.wordpress.com/2008/11/26/working-with-dal-data-access-layer-bllbusiness-logic-layer-in-aspnet-web-applications/ [ ^ ]

请帮我.
我被卡住了.

在此先感谢.



This line of code is giving me an error saying you missing a reference or assembly or a namespace.

This is the link I was following:

http://dotnetstories.wordpress.com/2008/11/26/working-with-dal-data-access-layer-bllbusiness-logic-layer-in-aspnet-web-applications/[^]

Please help me.
I am stuck.

Thanks in Advance.

推荐答案

您可能正在使用类型化的数据集.在这种情况下,您的数据集的表适配器将由Visual Studio生成.表适配器的类型在您的代码中未知,从而导致错误.

这意味着您没有在程序集中定义类型化的数据集(和tableadapter),或者没有正确引用程序集的来源.

以下是有关强类型数据集 [ ^ ]以帮助您会更加熟悉它们.
You are probably working with typed datasets. If that is the case, the table adapters for your datasets will be generated by Visual Studio. The type of the table adapter is not known in your code, resulting in the error.

That means that you did not define the typed dataset (and the tableadapter) in your assembly or you did not properly reference the assembly where it comes from.

Here is some info on strongly typed datasets[^] on MSDN to help you get more familiar with them.


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

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