473,394 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

why "import namespace=" ..." if not necessary?

Hi,

1) In file test.aspx, i put:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb"
Inherits="test" %>
<%@ import namespace="System.Data"%>
<%@ import namespace="System.Data.OleDb"%>
....

In file test.aspx.vb, i put:
....
Dim oConnection As System.Data.OleDb.OleDbConnection
....
No problem.It works.
----------------------------
2) But if i put in test.aspx.vb:
....
Dim oConnection As OleDbConnection
....
I get the error: "type OleDbConnection is not defined"
---------------------------
3) if i remove the import lines in test.aspx: and put this in test.aspx.vb:
Dim oConnection As System.Data.OleDb.OleDbConnection
.....

it works too.

So my question: why putting the import namespaces in test.aspx, because in
any way, I have to use "Dim oConnection As
System.Data.OleDb.OleDbConnection" instead of "Dim oConnection As
OleDbConnection" ?

Thanks
Chris



Why then the import in test.aspx?


May 10 '06 #1
3 2266
Hi Chris,

If you want to write the script in the same aspx page then the Import
statement is required other wise it's not required.

Hope this is clear.

Balu

"Chris" wrote:
Hi,

1) In file test.aspx, i put:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb"
Inherits="test" %>
<%@ import namespace="System.Data"%>
<%@ import namespace="System.Data.OleDb"%>
....

In file test.aspx.vb, i put:
....
Dim oConnection As System.Data.OleDb.OleDbConnection
....
No problem.It works.
----------------------------
2) But if i put in test.aspx.vb:
....
Dim oConnection As OleDbConnection
....
I get the error: "type OleDbConnection is not defined"
---------------------------
3) if i remove the import lines in test.aspx: and put this in test.aspx.vb:
Dim oConnection As System.Data.OleDb.OleDbConnection
.....

it works too.

So my question: why putting the import namespaces in test.aspx, because in
any way, I have to use "Dim oConnection As
System.Data.OleDb.OleDbConnection" instead of "Dim oConnection As
OleDbConnection" ?

Thanks
Chris



Why then the import in test.aspx?


May 10 '06 #2
Hi Balu,

Thanks for replying, but i still don't understand.

In my first file (test.aspx)
----------------------------
<%@ import namespace="System.Data"%>
<%@ import namespace="System.Data.OleDb"%>

In my second file (test.aspx.vb)
--------------------------------
Dim oConnection As OleDbConnection
This doesn't work.

I have to put:
Dim oConnection As System.Data.OleDb.OleDbConnection
But then, if i remove the import lines from test.aspx, it still works.

So why putting those imports lines?

"balucris" <ba******@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
Hi Chris,

If you want to write the script in the same aspx page then the Import
statement is required other wise it's not required.

Hope this is clear.

Balu

"Chris" wrote:
Hi,

1) In file test.aspx, i put:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb"
Inherits="test" %>
<%@ import namespace="System.Data"%>
<%@ import namespace="System.Data.OleDb"%>
....

In file test.aspx.vb, i put:
....
Dim oConnection As System.Data.OleDb.OleDbConnection
....
No problem.It works.
----------------------------
2) But if i put in test.aspx.vb:
....
Dim oConnection As OleDbConnection
....
I get the error: "type OleDbConnection is not defined"
---------------------------
3) if i remove the import lines in test.aspx: and put this in test.aspx.vb: Dim oConnection As System.Data.OleDb.OleDbConnection
.....

it works too.

So my question: why putting the import namespaces in test.aspx, because in any way, I have to use "Dim oConnection As
System.Data.OleDb.OleDbConnection" instead of "Dim oConnection As
OleDbConnection" ?

Thanks
Chris



Why then the import in test.aspx?


May 10 '06 #3
Import the namespaces in the file where you use them. If you want to use
the namespace in the vb file, import them there:

Imports System.Data
Imports System.Data.OleDb

Chris wrote:
Hi Balu,

Thanks for replying, but i still don't understand.

In my first file (test.aspx)
----------------------------
<%@ import namespace="System.Data"%>
<%@ import namespace="System.Data.OleDb"%>

In my second file (test.aspx.vb)
--------------------------------
Dim oConnection As OleDbConnection
This doesn't work.

I have to put:
Dim oConnection As System.Data.OleDb.OleDbConnection
But then, if i remove the import lines from test.aspx, it still works.

So why putting those imports lines?

"balucris" <ba******@discussions.microsoft.com> wrote in message
news:04**********************************@microsof t.com...
Hi Chris,

If you want to write the script in the same aspx page then the Import
statement is required other wise it's not required.

Hope this is clear.

Balu

"Chris" wrote:
Hi,

1) In file test.aspx, i put:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb"
Inherits="test" %>
<%@ import namespace="System.Data"%>
<%@ import namespace="System.Data.OleDb"%>
....

In file test.aspx.vb, i put:
....
Dim oConnection As System.Data.OleDb.OleDbConnection
....
No problem.It works.
----------------------------
2) But if i put in test.aspx.vb:
....
Dim oConnection As OleDbConnection
....
I get the error: "type OleDbConnection is not defined"
---------------------------
3) if i remove the import lines in test.aspx: and put this in test.aspx.vb: Dim oConnection As System.Data.OleDb.OleDbConnection
.....

it works too.

So my question: why putting the import namespaces in test.aspx, because in any way, I have to use "Dim oConnection As
System.Data.OleDb.OleDbConnection" instead of "Dim oConnection As
OleDbConnection" ?

Thanks
Chris



Why then the import in test.aspx?

May 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Vio | last post by:
Hi, I've been trying to embed (statically) wxPy alongside an embedded py interpreter on a linux/gtk box. At one point, for some reason misc.o linking reported "multiple definitions of...
9
by: monkey | last post by:
I just learn to make a blank windows frame with python and wxpython. I found the statment "import wx" cannot work as the original "from wxPython.wx import *". I see in the readme file of wxpython...
0
by: Bill Davy | last post by:
I am working with MSVC6 on Windows XP. I have created an MSVC project called SHIP I have a file SHIP.i with "%module SHIP" as the first line (file is below). I run SHIP.i through SWIG 1.3.24...
2
by: Vitali Gontsharuk | last post by:
Hi! I can't find an answer to the following question: does the "import" command in XML Schema import also element declarations? Or only type definitions? As far as I understood, the first takes...
0
by: maxim mat | last post by:
Hi I need to build client for web service. But when I'm using Visual Studio .NET to add Web Reference, I get error: "Custom tool error: Unable to import WebService/Schema. Unable to import...
5
by: mark_galeck_spam_magnet | last post by:
Hi, why does complain name 'compileFile' not defined. But works. Why? (I did read the tutorial, it seems to say "import module" should work. Thank you, Mark
14
by: Paulo da Silva | last post by:
Hi! If I have two files .py such as m.py from c import * ... x=c() ... os.any_method ...
1
by: Eric Hanchrow | last post by:
(This is with Python 2.5.2, on Ubuntu Hardy, if it matters.) This seems so basic that I'm surprised that I didn't find anything about it in the FAQ. (Yes, I am fairly new to Python.) Here are...
3
by: J. Cliff Dyer | last post by:
On Thu, 2008-05-08 at 12:00 -0700, Eric Hanchrow wrote: It's the same reason as this: 5 5 6 5 Python "variables" are just names that point at objects. When you
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.