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?
rxrazaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
daffodilsConnect With a Mentor Commented:
Hmm. I haven't heard of any restrictions regarding use of specific namespaces in composite server controls.

In this article about creating composite server control .. the author uses System.Data.
http://www.wimdows.net/articles/article.aspx?aid=10
0
 
daffodilsCommented:
Instead of the "using..." clause, you might as well use the fully qualified name.. System.Data.DataSet .. etc.
0
 
rxrazaAuthor Commented:
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?
0
 
rxrazaAuthor Commented:
Got it figured out. The namespace does not get included automatically in the references node. It has to manually added.
0
All Courses

From novice to tech pro — start learning today.