|
-
Feb 22nd, 2007, 06:42 AM
#1
Thread Starter
Hyperactive Member
Imports
Hi
I am using the vb.net and sql server 2005
Is it neccessary to Imports both
Imports System.Data
Imports System.Data.SqlClient
or - only
Imports System.Data.SqlClient
thanks
-
Feb 22nd, 2007, 06:54 AM
#2
Re: Imports
It's not necessary to import anything. Do you know what an import does? It allows you to refer to members of the name you import without qualifying them. If you import System.Data.SqlClient then you can just refer to an SqlConnection, while if you don't you have to qualify it, e.g. System.Data.SqlClient.SqlConnection. Now, having said that, System.Data is already imported by default. That means that you can refer to any members of System.Data unqualified, e.g. SqlClient.SqlConnection.
The moral of the story is that you don't have to import anything but you would normally import any namespaces whose members you will refer to regularly. If you don't intend to refer to a member of a namespace then you definitely wouldn't import it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|