Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends


i have problem
i have make a folder DBHelper on root. there is two file for connection string and dataaccess like 1)dbHelper.cs and 2)DatabaseHelper.cs. now when i make a code in aspx file and try to access the class its not working. its give the error like

'the type or namespace cannot be found are you missing a using directive or an assembly reference'

can anyone tell me that how can i give the reference to my aspx.cs file to access all the class from DBhelper.cs and DatabaseHelper.cs


Thank You To all...
Posted

You need to add a reference of dbhelper dll to your project. Then only you can access it.
 
Share this answer
 
Comments
Yatin chauhan 31-Jul-12 6:30am    
How Can i add that reference?
there is no any dll for that .its just a class file only.
I think both are there in different namespaces. If you want to call the class use the namespace as well.

For eg.

C#
namespace My.Namespace
{
    public class MyClass
    {
        public void MyMethod()
        {
            My.Other.Namespace.MyotherClass obj=new My.Other.Namespace.MyotherClass();

            obj.mymethod();
        }
    }
}

namespace My.Other.Namespace
{
    public class MyOtherClass
    {
        private void mymethod()
{
}
    }
}
 
Share this answer
 
v2
Comments
Yatin chauhan 31-Jul-12 6:32am    
Ye i think You right...but how can i solve that.
Santhosh Kumar Jayaraman 31-Jul-12 6:33am    
Wat is the name space for this class dbHelper.cs??
Hi,
If you are working with web application then use this:
Put the namespace in your class-file like:
C#
namespace WbAppName.DBHelper
{
    class clsTest 
    {
       //Code goes here
    }
}


Try this in your asp.cs file:
C#
using System;
using WbAppName.DBHelper;
//here WbAppName will be your web application name
class
{
    clsTest obj=new clsTest();//Now you can access your class-file
}



--Amit
 
Share this answer
 
Comments
Yatin chauhan 31-Jul-12 9:18am    
Thx u Now i Solved that........
Simple, put DBHelper folder with class files inside App_Code folder. Than you can access easily.
 
Share this answer
 
Comments
Yatin chauhan 31-Jul-12 6:35am    
oky .....now i delete the DBhelper folder and make this 2 class file directly in app_code folder in root directory.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900