vb.net 导入 System.Data.SqlClient .... 导入 System.Data ....?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15390730/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 12:46:59  来源:igfitidea点击:

Imports System.Data.SqlClient .... Imports System.Data ....?

asp.netvb.netimportsystem.data

提问by Pradeep

i am using both VISUAL WEB DEVELOPER 2010 & VISUAL STUDIO 2012 EXPRESS EDITION. While writing WINDOWS FORMS APPLICATION ... i used only one statement to work with DataSet,DataTable and Datarow.It is,

我正在使用 VISUAL WEB DEVELOPER 2010 和 VISUAL STUDIO 2012 EXPRESS EDITION。在编写 WINDOWS 表单应用程序时……我只使用了一个语句来处理 DataSet、DataTable 和 Datarow。它是,

Imports System.Data.SqlClient

But while developing WEB APPLICATIONS in ASP.NET using VISUAL WEB DEVELOPER 2010 , i had to use 2 statements.They are,

但是在使用 VISUAL WEB DEVELOPER 2010 在 ASP.NET 中开发 WEB 应用程序时,我不得不使用 2 个语句。它们是,

Imports System.Data.SqlClient
Imports System.Data

If i did not import System.Data, DataSet, DataRow, DataTableare not being recognized. What is the reason..?? I heard that BASE CLASS LIBRARY ( BCL ) is same for both windows & web application..??

如果我没有导入System.DataDataSet,DataRow,DataTable不会被识别。是什么原因..??我听说 BASE CLASS LIBRARY ( BCL ) 对于 windows 和 web 应用程序都是一样的..??

采纳答案by Harsha Vardhini

You should add a reference to the System.Data assembly, that holds the System.Data namespace, including System.Data.SqlClient. Once you added the reference, use

您应该添加对 System.Data 程序集的引用,该程序集包含 System.Data 命名空间,包括 System.Data.SqlClient。添加引用后,请使用

Import System.Data.SqlClient 

for a VB.NET project or

对于 VB.NET 项目或

using System.Data.SqlClient;

for a C# project.

对于 C# 项目。

The Import / Using statement makes the SqlClient namespace (located in the System.Data assembly) available to your code.

Import / Using 语句使 SqlClient 命名空间(位于 System.Data 程序集中)可用于您的代码。

回答by Civa

goto properties of your project change .net client profile to .net profile now check it

转到项目的属性将 .net 客户端配置文件更改为 .net 配置文件,现在检查它

回答by Ishwar Singh

in Visual Studio 2010

在 Visual Studio 2010 中

Step1 - Goto Project Property under Project Menu. Step2 - Under References of the Project Click Add Step3 - Select .Net Tab and select System.Data and OK

步骤 1 - 转到项目菜单下的项目属性。步骤 2 - 在项目的引用下单击添加步骤 3 - 选择 .Net 选项卡并选择 System.Data 并确定

:)

:)

回答by rogernjit

Go to Properties and Services check "Enable client application services".

转到属性和服务检查“启用客户端应用程序服务”。