Click to See Complete Forum and Search --> : cannot import System.Data


adonweb
04-30-2008, 07:06 AM
I cannot import the namespace "System.Data"

If i use

Imports System.Data in my vb file, i get the following error


Namespace or type 'Data' for the imports 'System.Data' cannot be found.

Whats the problem, please help me. any settings needed in .Net framework? or i miss some files

chazzy
04-30-2008, 09:17 AM
what version of .net? what version of visual studio/ide?

A1ien51
04-30-2008, 09:36 AM
you probably need to reference the Data.dll

Take a look at this kb: http://support.microsoft.com/kb/304260

Eric

Juspar
05-05-2008, 10:49 AM
I have a similar issue.

I'm using an Access 2007 adp file format, and am working i the VBA with .NET 2.0.50727 installed.

The references for my project included System.tlb, but if I try and add any of the .dll references (system.dll, system.data.dll, system.data.sqlxml.dll) I get an error message "Can't add a reference to the specified file".

Neither the imports declaration, nor the 'data' portion of 'system.data' is being sensed by intelitype, or recognised in compiling. I haven't even got to the errors that are rampant in my code yet, as I can't begin until I can dimension a new sqlcommand object.
imports System.Data
imports System.Data.sqlclient
Option Compare Database

Private Sub cmdLookup_Click()
On Error GoTo error_handler

Dim cmdUpdateProperty As New ...
System.Data is capitalizing, thus it myst be recognised, but the intelitype list that drops down after 'system.' doesn't include it.

kevinp
05-15-2008, 06:56 AM
Check to see that System.Data is included in the references for that particular project in Visual Studio.

Expand the project and then References. If System.Data is not listed right click References and click Add Reference.

On the .NET tab scroll down to System.Data and double click it to add it to your project.

You should now be able to add the relevant Imports statement to your code.