System.Data.sqlClient Class Compile Error

  • Thread starter Abbey Gwayambadde
  • Start date
A

Abbey Gwayambadde

I have a simple function that is supposed to import the
System.data.sqlClient class but it keeps saying during the compiling that
the class cannot be found.

Error is: BC30466: Namespace or type 'data' for the Imports 'System.Data'
cannot be found.
It then underlines the System.data section of the Imports declaration. The
code for my .vb file is below.

' estoreDataLayer.vb
'
Imports System
Imports System.Data


Namespace estore

Public Class dataLayer
Public Sub New()

End Sub

Public Shared Function getDataReader( _
byVal sqlString As String) As sqlDataReader

dim myReader As sqlDataReader
dim myCommand As new sqlCommand()

with myCommand
.Connection = New sqlConnection(dataLayer.connString())
.connection.open()

.CommandText = sqlStatement
myReader = .ExecuteReader(CommandBehaviour.CloseConnection)
End with

Return myReader
End Function
End Class
End Namespace
 
H

Herfried K. Wagner [MVP]

Hello,

Abbey Gwayambadde said:
I have a simple function that is supposed to import the
System.data.sqlClient class but it keeps saying during
the compiling that the class cannot be found.

Error is: BC30466: Namespace or type 'data' for the
Imports 'System.Data' cannot be found.
It then underlines the System.data section of the Imports declaration. The
code for my .vb file is below.

Are you sure a reference to "System.Data.dll" is set?

Regards,
Herfried K. Wagner
 
A

Abbey Gwayambadde

I am not sure how to check to see if system.data is referenced. In my
many infinit tries, I have also discovered the on complilation, the
system namespace compiles fine, so does the system.IO clas but
system.Net give the same "not found" error. HOWEVER, all my applications
that reference these codes inline(Asp.net) using a <%@ Import
namespace="system.data" %> work without an error. The problem seems to
lie in the vbc.exe compilor program loading the class.

I hope this helps with your trying to help me.
 
H

Herfried K. Wagner [MVP]

Abbey Gwayambadde said:
I am not sure how to check to see if system.data is
referenced. In my many infinit tries, I have also discovered
the on complilation, the system namespace compiles fine,
so does the system.IO clas but system.Net give the same
"not found" error. HOWEVER, all my applications
that reference these codes inline(Asp.net) using a <%@ Import
namespace="system.data" %> work without an error.
The problem seems to lie in the vbc.exe compilor program
loading the class.

You may want to turn to the ng for ASP.NET questions:

news://msnews.microsoft.com/microsoft.public.dotnet.framework.aspnet

Web interface:

http://msdn.microsoft.com/newsgroup...roup=microsoft.public.dotnet.framework.aspnet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top