Quote:
Originally Posted by ashishforindia
I am using VS2005.
Sir/madam,
If I wants to fetch the data(single or multiple) from database in some control(other than data controls) in windows application,then what will be the entire code. Please help me.
|
Write a class/Method that returns your data as something derived from one of the List object types. Personally, I use ADO.NET and often return an actual DataTable reference. There are other ways to achieve the same thing, such as using a Typed Schema object which does all of the code/guts for you and you can use the little WYSIWYG sql designer if you like. There are pros and cons of each way.
That class will then be part of your architectual "Data Access Layer" or DAL.
Then, your DAL can serve data to anything, web, windows clients, services etc. simply by including the class (or library) into a project.
Okay, its not that simple but its a fairly evolved best practice.
If you want some specific code, take a look at the Data access tutorial on the ASP.NET web site. http://www.asp.net/learn/data-access/
Its focused on doing data access stuff in ASP.NET but the first two turtorials on DAL and BLL creation are relevent to pretty much any target platform in .NET
Good luck!
__________________
The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair. -Douglas Adams
|