p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Basics (http://p2p.wrox.com/forumdisplay.php?f=136)
-   -   function return 'Nothing' problem (http://p2p.wrox.com/showthread.php?t=26660)

srinuRocks March 10th, 2005 10:32 AM

function return 'Nothing' problem
 
Hello,

I need help regarding following code!!! the Second function public ICollection GetCollection returning nothing....plz. help me out

private void Page_Load(object sender, System.EventArgs e)
{
SNo.DataField="RefId";
SNo.HeaderText="S.No";

SchoolCode.DataField="SchoolCode";
SchoolCode.HeaderText="School Code";

SchoolName.DataField="SchoolName";
SchoolName.HeaderText="School Name";
SchoolName.ItemStyle.Wrap=false;

BuildingTypeDG.DataSource=GetCollection();

BuildingTypeDG.DataBind();
}

public ICollection GetCollection()
{
    objModule.ConnectData();
    objModule.ObjCmd1.CommandText = objModule.sql;
    objModule.sqlReader1 = objModule.ObjCmd1.ExecuteReader();

    DataTable Dt=new DataTable();
    DataRow DRow;

    Dt.Columns.Add("RefId");
    Dt.Columns.Add("SchoolCode");
    Dt.Columns.Add("SchoolName");

    BuildingTypeDG.AutoGenerateColumns=false;
    objModule.G_Int_J = 1;

     while (objModule.sqlReader1.Read())
    {
        DRow = Dt.NewRow();
        DRow[0]=objModule.G_Int_J;
        DRow[1]=objModule.sqlReader1.GetValue(2);
        DRow[2]=objModule.sqlReader1.GetValue(1);

        Dt.Rows.Add(DRow);
        objModule.G_Int_J = objModule.G_Int_J + 1;

    }
    objModule.sqlReader1.Close();

    return new DataView(Dt);

}


All times are GMT -4. The time now is 03:41 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.