1

My asp.net code calls a DataAccessLayer class (SubscriberDAL.cs) that does that database query & returns records. I am calling that class from my Search.aspx.cs page. The SubscriberDAL.cs method returns records in List format. How can I capture those records from my Search.aspx.cs page?

So in the code sample below, PremsubList returns a list array. How can I view those in Search.aspx.cs ?

My code is:

Search.aspx.cs:

PremCustomerMgr.GetSubscriberList(sub);  

SubscriberDAL.cs

public static List<PremSubscriber.Subscriber> GetSubscriberList(PremSubscriber.Subscriber QueryData)
{
    try
    {
        List<PremSubscriber.Subscriber> PremsubList = new List<PremSubscriber.Subscriber>();

        PremCustomerDAL.SearchSubscriberData(PremsubList, QueryData);
        return PremsubList;
    }
    catch (Exception ex)
    {
        GCException gcEx = new GCException("Exception - PremCustomerMgr.GetSubscriberList", ex);
        throw psEx;
    }
}
4

2 回答 2

3

您可以将方法调用的结果用作DatasourceSearch.aspx 上的控件。

例如,如果您DataGridView在页面中添加一个,您可以执行以下操作:

MyDataGridView.Datasource = PremCustomerMgr.GetSubscriberList(sub); 
MyDataGridView.Databind();
于 2012-07-19T20:18:50.230 回答
2

呃...

var MyResults = PremCustomerMgr.GetSubscriberList(sub);  

?

接下来,使用 MyResults 做一些事情。

也许您需要澄清“如何从我的 Search.aspx.cs 页面捕获这些记录”的含义。解释“捕获”?或者,也许您可​​以更详细地解释您要达到的目标?也许发布更多(相关!)代码?

于 2012-07-19T20:17:18.433 回答