1

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,

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,

Imports System.Data.SqlClient
Imports System.Data

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

Pradeep
  • 1,193
  • 6
  • 27
  • 44
  • Have a look at the references tab in your project. I assume that `System.Data` is imported by default in VB.NET-winforms applications. You can add other dll's as well there if you don't want to include the imports statement in all your files. – Tim Schmelter Mar 13 '13 at 16:21

4 Answers4

1

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

Import System.Data.SqlClient 

for a VB.NET project or

using System.Data.SqlClient;

for a C# project.

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

Mariusz Jamro
  • 30,615
  • 24
  • 120
  • 162
Harsha Vardhini
  • 692
  • 6
  • 10
0

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

Civa
  • 2,058
  • 2
  • 18
  • 30
0

in 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

:)

0

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