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}:WebTrai lLogger runat=server creator=raza></{0}:WebTrai lLogger>") ]
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.getConnectionSt ring((int) Constant.C ONNECTIONS TRINGLOCAT IONS.SETTI NGS_XML,
(int)Constant.DATABASE.DAT ABASE1)
);
// Get an Empty Dataset
DataSet ds = objDA.Get("");
objDA.Get(userId);
}
catch(Exception err)
{
Debug.WriteLine(err.ToStri ng());
}
}
}
But the compiler would not let it go until it sees
using System.Data on the top?
What do I need to do?
System.Data in the following snippet
[ToolboxData("<{0}:WebTrai
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.getConnectionSt
(int)Constant.DATABASE.DAT
);
// Get an Empty Dataset
DataSet ds = objDA.Get("");
objDA.Get(userId);
}
catch(Exception err)
{
Debug.WriteLine(err.ToStri
}
}
}
But the compiler would not let it go until it sees
using System.Data on the top?
What do I need to do?
Instead of the "using..." clause, you might as well use the fully qualified name.. System.Data.DataSet .. etc.
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Got it figured out. The namespace does not get included automatically in the references node. It has to manually added.