In addition to what Mattias said,
if using System.Data should make your statement work then question is just
by writing System every thing should work,
e.g.
using System;
....
....
OleDbConnection oleDbConnection1
it should create a object too, right? After all it is some place inside
System namespace.
Actually, it do not work like that. Reason is that using makes methods,
interface, and other stuff inside that namespace visible but not a namespace
in side it for inline use. One of the reason I can think of is that I can
have my own namespace named to be OleDB and it could have all the stuff
other than what you are hoping to see or something that you do not want but
is used with totally different output. Very much like having the same method
name in visible namespace structures (which actually gives compile error,
and intellisense shows it as read dot in front). In that condition you will
have to fully qualify it to avoid any error. If just using higher namespace
structure solves the problem then there will be lots of name collision which
will defeat the real purpose behind namespacing.
That is the base idea behind namespacing anyways, to avoid collisions while
naming.
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Can someone please explain why these need to have System.Data specified,
when this namespace is already specified in a 'using' statement.
Because System.Data != System.Data.OleDb, even though they happen to
share a common prefix. If you add
using System.Data.OleDb;
you can then change the code to
protected OleDbConnection oleDbConnection1;
protected OleDbDataAdapter oleDbDataAdapter2;
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.