Link to home
Start Free TrialLog in
Avatar of rxraza
rxraza

asked on

using System.Data namespace in Web Custom Control

Why can't I use System.Data namespace in a web custom control? I am making a reference to the namespace
System.Data in the following snippet

[ToolboxData("<{0}:WebTrailLogger runat=server creator=raza></{0}:WebTrailLogger>")]
public class PWWebTrailLogger
{
// override the DayRender function
public void Log(WEB_AUDIT_TRAIL_INFO info,string userId,string SessionId)
{
try
      {
      DAWebRequestTrail objDA = new DAWebRequestTrail(
            Connection.getConnectionString((int)Constant.CONNECTIONSTRINGLOCATIONS.SETTINGS_XML,
                              (int)Constant.DATABASE.DATABASE1)
                              );
      // Get an Empty Dataset
      DataSet ds = objDA.Get("");
      objDA.Get(userId);
      }
catch(Exception err)
{
      Debug.WriteLine(err.ToString());
}
}
}

But the compiler would not let it go until it sees

using System.Data on the top?

What do I need to do?
Avatar of daffodils
daffodils

Instead of the "using..." clause, you might as well use the fully qualified name.. System.Data.DataSet .. etc.
Avatar of rxraza

ASKER

Yes, of course we can use fully qualified name
like System.Data.DataSet but the problem is in the context of Web Custom Control that namespace is not visible. Does anyone know why?
ASKER CERTIFIED SOLUTION
Avatar of daffodils
daffodils

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rxraza

ASKER

Got it figured out. The namespace does not get included automatically in the references node. It has to manually added.