Code Project

Link Unit

Friday, September 04, 2009

The type or namespace name 'Data' does not exist in the namespace 'System' (are you missing an assembly reference?)

This is a common but simple problem to solve , below is explanation and steps to solve.

using Directives at the top of code files just allows you to use types in a namespace without having to fully qualify them.
e.g. using System.Data directive allows you to declare a DataColumn as following:

DataColumn dc = new DataColumn();

instead of:

System.Data.DataColumn dc = new System.Data.DataColumn();

using statements define scope, but you still need a reference to the Library so that the project will build.

Do you see System.Data listed under it?
Open your solution explorer and Expand References:
More than likely not, hence the complaint from the Compiler.

What to do/ how to Solve??

Right click on References, and from the Context Menu, select "Add Reference"
The Add Reference view will default to the .NET tab, scroll down until you find the System.Data, select it and click the OK button.

Build your app.

Hope it Helps

1 comment:

Unknown said...

Thank you! Thank you! Thank you!!!

Stupid simple error, but finding your blog fixed it in minutes instead of me trying to guess which way to go next to troubleshoot this.