Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error-'The type or namespace name 'xxxx' ...massage 1

Status
Not open for further replies.

JOBARAM

Programmer
May 25, 2002
52
IL
Hi,
I am just creating my first Project in C#,be patient if you can.
My objective is to create a GUI that will interact with the sql server db.
I have created 'Client' project, so far so good.
I added a project 'DataAccess' that includes all classes that do the connection to the db.
Now, my problem is to connect between the client and the DataAccess projects.
In the Client side I added -
Using DataAccess.Connection
Building the solution raised an error:
"The type or namespace name 'DataAccess' could not be found (are you missing a using directive or an assembly reference?)".
How can I connect with the DataAccess project?
Thanks
Yossi




 
You need to add a reference to the DataAccess project. There are two ways to do this.

This presumes you have built the DataAccess project which should be a "Class Library" project. When you build a class library it creates a DLL in the Debug or Release directory.

If you don't expect to make changes to DataAccess you can add a reference to your solution by right clicking on References in the Solution View and choose Add Reference... from the menu.

This brings up the "Add Reference" form. Click the "Browse" button on the right and navigate to the DataAccess project directory and find the DataAccess.dll in the Debug or Release directory.

Voila. You are done. You still have to put the "using DataAccess" in your code.

Dean
---
 
The second way to do this is to add the DataAccess project to your Client project.

In the Solution Explorer view, right click the "Client Solution" at the top of the tree. A menu should appear. Select "Add... > Existing Project"

Navigate to the "DataAccess" project and add it to your Client solution.

On the main menu, Project > Add Reference... brings up the same Add Reference form in the prior email. Now choose the "Projects" tab at the top. Your newly added project should appear. Select it, click select on the right, then OK at the bottom. You are set to roll.

You still need to add "using DataAccess" if you don't want to explicitly refer to the namespace.
Dean
---
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top