Imports statement supplies references to all definitions in the namespace.
So, if you use any classes from the System.Data namespaces, use Imports
System.Data. In your example both SqlConnection and SqlCommand belong to the
System.Data.SqlClient namespace, so use Imports System.Data.SqlClient.
In fact, you can always use full names like
connection = New System.Data.SqlClient.SqlConnection(connectionstr)
In this case you don't need to use Imports statement.
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin http://usableasp.net
"Albert" <wx***@sss.sdwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,
when do i need this: Imports System.Data
and when this: Imports System.Data.SqlClient?
More specifically, when i want to perform a select or update of a table
using:
connection = New SqlConnection(connectionstr)
comd = New SqlCommand()
do i need both?
Thanks
Albert