ADO does not exist in class or namespace

  • Thread starter Jon Smith via DotNetMonster.com
  • Start date
J

Jon Smith via DotNetMonster.com

Hi all,

I'm new to C# and am practising the language by writing simple contact
manager programmes. I'm having a problem using ADO. I'm trying to connect
to an Access 2000 database using ADO.Net. When compiling I'm getting the
following error :
The type or namespace name 'ADO' does not exist in the class or namespace
'System')are you missing an assembly reference?)

I've included the 'using System.Data.ADO' namespace, although when I typed
the 'using System.Data.' part I only got the classes
'Common','OleDb','SqlClient' and 'SqlTypes' in the drop-down list. 'ADO'
wasn't one of the list options.

I'm using MS Visual Studio 2002 - 1.0 framework.

Am I doing somthing wrong?? - PLEASE HELP!!

Many thanks,
Jon.
 
P

Peter van der Goes

Jon Smith via DotNetMonster.com said:
Hi all,

I'm new to C# and am practising the language by writing simple contact
manager programmes. I'm having a problem using ADO. I'm trying to
connect
to an Access 2000 database using ADO.Net. When compiling I'm getting the
following error :
The type or namespace name 'ADO' does not exist in the class or namespace
'System')are you missing an assembly reference?)

I've included the 'using System.Data.ADO' namespace, although when I typed
the 'using System.Data.' part I only got the classes
'Common','OleDb','SqlClient' and 'SqlTypes' in the drop-down list. 'ADO'
wasn't one of the list options.

I'm using MS Visual Studio 2002 - 1.0 framework.

Am I doing somthing wrong?? - PLEASE HELP!!

Many thanks,
Jon.

Are you trying to use ADO or ADO.NET? You seem to be looking for a mix of
the two, as you refer to some of the ADO.NET classes, yet you say you are
looking for "ADO".
If the application you're developing has an interface, try this: use Server
Explorer to establish a connection to your Access database. Then display the
tables in Server Explorer and drag a table to your interface. That should
automatically create an OleDbConnection object for you.
You may also want to refer to the numerous articles on ADO.NET in your MSDN
Help, such as ".NET Samples - How To: Data and ADO.NET" and "Accessing Data
With ADO.NET".
 
J

Jon Smith via DotNetMonster.com

Hi Peter,

Thanks for replying.

I'm trying use ADO.Net as I'm using VS.Net. I really want to stick with
ADO.Net the reason being is I'm actually following the below site's
information on how to DataBind a textbox to Data.

http://www.mastercsharp.com/article.aspx?ArticleID=4&&TopicID=8

It's actually the error message, after compiling, that says 'ADO' and not
'ADO.Net'. I guess it only says 'ADO' as this is the namespace I've
entered i.e. using System.Data.ADO

Various internet sites say exactly what the above is site says in how to
connect to a database using ADO.Net. Although for some reason a compile
error occurs when I try.

Thanks,
Jon.
 
G

Guest

Sounds like you just need to add the "Reference" to System.Data to your
project. The using statement alone is not enough.
 
J

Jon Smith via DotNetMonster.com

Hi Thom,

Thanks for replying.

I thought of that and looked to see if I could add the reference. I right
mouse clicked on the project - clicked 'add reference' - but I couldn't
find a reference for ADO(being in VS.net a reference for ADO.net). Did I
go about this in the right way? Do I have to import the dll to the
references or should it already be there?

Thanks,
Jon.
 
J

Jon Smith via DotNetMonster.com

Thom,

I'm not sure if I understand what you mean but ading a reference so I can
use 'using System.Data;' wouldn't the problem because I'm already using
other classes of the 'System.Data' namespace. It is the particular 'using
System.Data.ADO;' statement that the compiler doesn't like. Infact the
'ADO' part of the 'using System.Data.ADO;' is underlined in blue indicating
some error.

Thanks again,
Jon.
 
G

Guest

I should have paid more attention. There is no namespace "System.Data.ADO". I
believe that "System.Data" is all you should need. There should be plenty of
examples on MSDN or Google to show you what you need. Hope this helps.
 
J

Jon Smith via DotNetMonster.com

Hi guys,

I've just been looking on the web for articles on connecting to a database
using ADO.Net. Some examples are showing the 'using System.Data.ADO;'
namespace at the top of the code and other examples are not showing this
namespace. When I have used this namespace I get a compile error.
Is there such a namespace as 'using System.Data.ADO;'
Someone please help? or please provide a link, with an example that works,
for DataBinding to textboxes using ADO.Net??

Many thanks,
Jon.
 
B

Bjorn Abelli

...
I've just been looking on the web for articles on connecting
to a database using ADO.Net. Some examples are showing the
'using System.Data.ADO;' namespace at the top of the code
and other examples are not showing this namespace.

The example you provided a link to says that it used the *beta* version of
..NET.

If that namespace existed in the beta, it never made it to the final
release.

Instead you should use System.Data.OleDb instead of System.Data.ADO, and
subsequently the classes OleDB*, instead of ADO*.

// Bjorn A
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top