I have got error. Please help me out.
The type or namespace name ‘Utilities’ could not be found (are you missing a using directive or an assembly reference?)
I have made a class with the namespace Utililties.
namespace Utilities
{
public class DatabaseManager
{
public string commandText;
OdbcCommand cmd = new OdbcCommand();
OdbcTransaction _tran = null;
public DatabaseManager(String dbConn) {
OdbcConnection _conn = new OdbcConnection(dbConn);
cmd = _conn.CreateCommand();
_conn.Open();
}
public void setParameter(string name, OdbcType type, object value)
{
cmd.Parameters.Add(name, type).Value = value;
}
}
}
The class works fine but I also have the same problem when using in from another project. I wonder what’s happening and how to fix the problem.
using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Data.Odbc;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using Utilities; // This line have error highlighted in red color
You need to use using namespace directive to import the types in name space, The other project (website) where you are accessing class would have different namespace. Make sure that you import by adding reference of the dll which has Utilities namespace. The statement given below will import types in Utilities, if containing assembly is available.
Edit: If you have types in the namespace Utilities within website then you try putting them in app_code folder and build the website before you access them.