Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 10th, 2005, 10:32 AM
Registered User
 
Join Date: Feb 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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);

}





Similar Threads
Thread Thread Starter Forum Replies Last Post
return collection by function in class jimusa Visual Basic 2005 Basics 1 July 30th, 2008 03:18 PM
How to return array value from a function nebpro BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 September 29th, 2004 12:14 PM
how to get a function to return a recordset object lcsgeek Classic ASP Databases 3 September 22nd, 2004 03:30 PM
public function execute = HELP! Return value ? davidkwang VS.NET 2002/2003 0 April 28th, 2004 12:18 PM
Return a UDT from a function alex_read Pro VB 6 1 April 23rd, 2004 05:37 AM





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