Wrox Programmer Forums
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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 25th, 2011, 12:45 AM
Registered User
 
Join Date: Mar 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Question class

public List<fst> disp()
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd= new SqlCommand("select * from trial",con);
cmd.Connection=con;
SqlDataReader dr = cmd.ExecuteReader();
List<fst> obj = new List<fst>();
if (dr.HasRows)
{
dr.Read();
fst k = new fst();
k.id_p = dr[0];
k.name_p = dr[1];
k.city_p = dr[2];
obj.Add(k);
}
dr.Close();
return obj;
}
i have written this code in the class to use in he select button in object data source,but when i click on configure object data source this method is not displayed for selection.In fact the class is not displayed to select.
 
Old March 25th, 2011, 03:49 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Where did you create this method? Did you try creating it in a class in your project (inside App_Code when you're using a Web Site Project)? And does the class have a public constructor?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
calling a parent class method from a child class (Zend Cert) crmpicco Beginning PHP 2 July 30th, 2010 04:22 AM
Passing an event from a class to the class that created it? dcellis1950 Visual C++ 3 October 6th, 2009 11:14 AM
Property access from Class within Partial Class zoltac007 C# 2005 0 December 1st, 2006 01:01 AM
Regarding Class Library (.dll) from class file manish.sharma04 BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 March 3rd, 2006 07:32 AM
How to include c# class and vb class in the .vbprj umeshayk VS.NET 2002/2003 2 January 9th, 2004 12:08 AM





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