Solved

using System.Data namespace in Web Custom Control

Posted on 2004-08-12
4
488 Views
Last Modified: 2008-03-17
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?
0
Comment
Question by:rxraza
  • 2
  • 2
4 Comments
 
LVL 8

Expert Comment

by:daffodils
ID: 11788126
Instead of the "using..." clause, you might as well use the fully qualified name.. System.Data.DataSet .. etc.
0
 

Author Comment

by:rxraza
ID: 11788370
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
 
LVL 8

Accepted Solution

by:
daffodils earned 100 total points
ID: 11788891
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
 

Author Comment

by:rxraza
ID: 11789040
Got it figured out. The namespace does not get included automatically in the references node. It has to manually added.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now