Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Problems importing System.Data


Message #1 by "Hugh McLaughlin" <hugh@k...> on Thu, 31 Jan 2002 11:45:31
Hello Everyone and thanks for your help in advance.  I am building a

business component for accessing a database via and ASP.net page.  It is

similar to pages on the IBuySpy example on www.asp.net.  I am running

into problems importing a namespace.  I am using the following code:



Imports System

Imports System.Data

Imports System.Configuration

Imports System.Data.SqlClient



More Code Here....



When I compile, I receive the following error:



error BC30466:  Namespace or type 'Data' for the imports 'System.Data' 

cannot be

found.



To ensure that everything was running properly on my system, I tried the 

same code



<%@ Import Namespace="System.Data" %>



in an aspx page and it worked fine.



Not sure what is happening here.  Any help would be greatly appreciated.



Thanks. 
Message #2 by "Greg Quinn" <greg@i...> on Thu, 31 Jan 2002 15:09:58 -0800
when you are declaring your namespaces in a class file or .vb source file

use the Imports directive.



When you are declaring the namespaces in an .aspx page or global.asax page,

use the <%@ Import Namespace = "xx" %> directive.



Greg





-----Original Message-----

From: Hugh McLaughlin [mailto:hugh@k...]

Sent: 31 January 2002 11:46

To: ASP+

Subject: [aspx] Problems importing System.Data





Hello Everyone and thanks for your help in advance.  I am building a

business component for accessing a database via and ASP.net page.  It is

similar to pages on the IBuySpy example on www.asp.net.  I am running

into problems importing a namespace.  I am using the following code:



Imports System

Imports System.Data

Imports System.Configuration

Imports System.Data.SqlClient



More Code Here....



When I compile, I receive the following error:



error BC30466:  Namespace or type 'Data' for the imports 'System.Data'

cannot be

found.



To ensure that everything was running properly on my system, I tried the

same code



<%@ Import Namespace="System.Data" %>



in an aspx page and it worked fine.



Not sure what is happening here.  Any help would be greatly appreciated.



Thanks.






Message #3 by "Hugh McLaughlin" <hugh@k...> on Thu, 31 Jan 2002 13:58:57
> when you are declaring your namespaces in a class file or .vb source 

file

> use the Imports directive.

> 

> When you are declaring the namespaces in an .aspx page or global.asax 

page,

> use the <%@ Import Namespace = "xx" %> directive.

> 

> Greg

> 

> 

> -----Original Message-----

> From: Hugh McLaughlin [mailto:hugh@k...]

> Sent: 31 January 2002 11:46

> To: ASP+

> Subject: [aspx] Problems importing System.Data

> 

> 

> Hello Everyone and thanks for your help in advance.  I am building a

> business component for accessing a database via and ASP.net page.  It is

> similar to pages on the IBuySpy example on www.asp.net.  I am running

> into problems importing a namespace.  I am using the following code:

> 

> Imports System

> Imports System.Data

> Imports System.Configuration

> Imports System.Data.SqlClient

> 

> More Code Here....

> 

> When I compile, I receive the following error:

> 

> error BC30466:  Namespace or type 'Data' for the imports 'System.Data'

> cannot be

> found.

> 

> To ensure that everything was running properly on my system, I tried the

> same code

> 

> <%@ Import Namespace="System.Data" %>

> 

> in an aspx page and it worked fine.

> 

> Not sure what is happening here.  Any help would be greatly appreciated.

> 

> Thanks.




> 

I am.  The code at the top of my message is the one that is failing.  Se 

below:



Imports System

Imports System.Data  ***This is the line that is causing the error.
Message #4 by "Greg Quinn" <greg@i...> on Thu, 31 Jan 2002 16:05:00 -0800
Please post the full source so we can take a good look. Also, what file is

it in? .vb or a class file or what?



PS : Why when you reply to an email do you type at the very bottom of the

mail??? Standard practise is to type in your reply at the top of the mail. I

looked at your reply and almost deleted it cos I though you hadn't typed

anything!!



Greg





-----Original Message-----

From: Hugh McLaughlin [mailto:hugh@k...]

Sent: 31 January 2002 01:59

To: ASP+

Subject: [aspx] RE: Problems importing System.Data





> when you are declaring your namespaces in a class file or .vb source

file

> use the Imports directive.

>

> When you are declaring the namespaces in an .aspx page or global.asax

page,

> use the <%@ Import Namespace = "xx" %> directive.

>

> Greg

>

>

> -----Original Message-----

> From: Hugh McLaughlin [mailto:hugh@k...]

> Sent: 31 January 2002 11:46

> To: ASP+

> Subject: [aspx] Problems importing System.Data

>

>

> Hello Everyone and thanks for your help in advance.  I am building a

> business component for accessing a database via and ASP.net page.  It is

> similar to pages on the IBuySpy example on www.asp.net.  I am running

> into problems importing a namespace.  I am using the following code:

>

> Imports System

> Imports System.Data

> Imports System.Configuration

> Imports System.Data.SqlClient

>

> More Code Here....

>

> When I compile, I receive the following error:

>

> error BC30466:  Namespace or type 'Data' for the imports 'System.Data'

> cannot be

> found.

>

> To ensure that everything was running properly on my system, I tried the

> same code

>

> <%@ Import Namespace="System.Data" %>

>

> in an aspx page and it worked fine.

>

> Not sure what is happening here.  Any help would be greatly appreciated.

>

> Thanks.




>

I am.  The code at the top of my message is the one that is failing.  Se

below:



Imports System

Imports System.Data  ***This is the line that is causing the error.






Message #5 by "Hugh McLaughlin" <hugh@k...> on Thu, 31 Jan 2002 14:38:59
Here is the code:



Imports System

Imports System.Data

Imports System.Configuration

Imports System.Data.SqlClient



Namespace MyPortal



	Public Class ManageUsersDB



		Public Function ReadUsers AS DataSet



			Dim myConnection As New SqlConnection

(ConfigurationSettings.AppSettings("connectionString"))



      			Dim myCommand As New SQLDataAdapter

("sp_ReadUsers",myConnection)



			Dim myDataset AS New DataSet



			myCommand.Fill(myDataSet)



			Return myDataset



		End Function



	End Class



End Namespace





The code is in a file called MyPortal.VB



Thanks for the help.









> Please post the full source so we can take a good look. Also, what file 

is

> it in? .vb or a class file or what?

> 

> PS : Why when you reply to an email do you type at the very bottom of 

the

> mail??? Standard practise is to type in your reply at the top of the 

mail. I

> looked at your reply and almost deleted it cos I though you hadn't typed

> anything!!

> 

> Greg

> 

> 

> -----Original Message-----

> From: Hugh McLaughlin [mailto:hugh@k...]

> Sent: 31 January 2002 01:59

> To: ASP+

> Subject: [aspx] RE: Problems importing System.Data

> 

> 

> > when you are declaring your namespaces in a class file or .vb source

> file

> > use the Imports directive.

> >

> > When you are declaring the namespaces in an .aspx page or global.asax

> page,

> > use the <%@ Import Namespace = "xx" %> directive.

> >

> > Greg

> >

> >

> > -----Original Message-----

> > From: Hugh McLaughlin [mailto:hugh@k...]

> > Sent: 31 January 2002 11:46

> > To: ASP+

> > Subject: [aspx] Problems importing System.Data

> >

> >

> > Hello Everyone and thanks for your help in advance.  I am building a

> > business component for accessing a database via and ASP.net page.  It 

is

> > similar to pages on the IBuySpy example on www.asp.net.  I am running

> > into problems importing a namespace.  I am using the following code:

> >

> > Imports System

> > Imports System.Data

> > Imports System.Configuration

> > Imports System.Data.SqlClient

> >

> > More Code Here....

> >

> > When I compile, I receive the following error:

> >

> > error BC30466:  Namespace or type 'Data' for the imports 'System.Data'

> > cannot be

> > found.

> >

> > To ensure that everything was running properly on my system, I tried 

the

> > same code

> >

> > <%@ Import Namespace="System.Data" %>

> >

> > in an aspx page and it worked fine.

> >

> > Not sure what is happening here.  Any help would be greatly 

appreciated.

> >

> > Thanks.




> >

> I am.  The code at the top of my message is the one that is failing.  Se

> below:

> 

> Imports System

> Imports System.Data  ***This is the line that is causing the error.




> 

Message #6 by "Martin Reeve" <mbreeve@r...> on Thu, 31 Jan 2002 15:05:06
The problem appears to that you are not including the required 

assembly/dll in your compilation command line. (I'm assuming you're not 

using Visual Studio.)



The compilation line should be something like:

   vbc /t:library /out:... MyPortal.vb /r:System.dll,System.Data.dll



I think most "normal" namespaces are in System.dll, which probably gets 

included automatically anyway.



Hope this works for you...



Martin Reeve







> Here is the code:

> 

> Imports System

> Imports System.Data

> Imports System.Configuration

> Imports System.Data.SqlClient

> 

> Namespace MyPortal

> 

> 	Public Class ManageUsersDB

> 

> 		Public Function ReadUsers AS DataSet

> 

> 			Dim myConnection As New SqlConnection

> (ConfigurationSettings.AppSettings("connectionString"))

> 

>       			Dim myCommand As New SQLDataAdapter

> ("sp_ReadUsers",myConnection)

> 

> 			Dim myDataset AS New DataSet

> 

> 			myCommand.Fill(myDataSet)

> 

> 			Return myDataset

> 

> 		End Function

> 

> 	End Class

> 

> End Namespace

> 

> 

> The code is in a file called MyPortal.VB

> 

> Thanks for the help.

> 

> 

> 

> 

> > Please post the full source so we can take a good look. Also, what 

file 

> is

> > it in? .vb or a class file or what?

> > 

> > PS : Why when you reply to an email do you type at the very bottom of 

> the

> > mail??? Standard practise is to type in your reply at the top of the 

> mail. I

> > looked at your reply and almost deleted it cos I though you hadn't 

typed

> > anything!!

> > 

> > Greg

> > 

> > 

> > -----Original Message-----

> > From: Hugh McLaughlin [mailto:hugh@k...]

> > Sent: 31 January 2002 01:59

> > To: ASP+

> > Subject: [aspx] RE: Problems importing System.Data

> > 

> > 

> > > when you are declaring your namespaces in a class file or .vb source

> > file

> > > use the Imports directive.

> > >

> > > When you are declaring the namespaces in an .aspx page or global.asax

> > page,

> > > use the <%@ Import Namespace = "xx" %> directive.

> > >

> > > Greg

> > >

> > >

> > > -----Original Message-----

> > > From: Hugh McLaughlin [mailto:hugh@k...]

> > > Sent: 31 January 2002 11:46

> > > To: ASP+

> > > Subject: [aspx] Problems importing System.Data

> > >

> > >

> > > Hello Everyone and thanks for your help in advance.  I am building a

> > > business component for accessing a database via and ASP.net page.  

It 

> is

> > > similar to pages on the IBuySpy example on www.asp.net.  I am running

> > > into problems importing a namespace.  I am using the following code:

> > >

> > > Imports System

> > > Imports System.Data

> > > Imports System.Configuration

> > > Imports System.Data.SqlClient

> > >

> > > More Code Here....

> > >

> > > When I compile, I receive the following error:

> > >

> > > error BC30466:  Namespace or type 'Data' for the 

imports 'System.Data'

> > > cannot be

> > > found.

> > >

> > > To ensure that everything was running properly on my system, I tried 

> the

> > > same code

> > >

> > > <%@ Import Namespace="System.Data" %>

> > >

> > > in an aspx page and it worked fine.

> > >

> > > Not sure what is happening here.  Any help would be greatly 

> appreciated.

> > >

> > > Thanks.




> > >

> > I am.  The code at the top of my message is the one that is failing.  

Se

> > below:

> > 

> > Imports System

> > Imports System.Data  ***This is the line that is causing the error.




> > 


  Return to Index