views:

59

answers:

4

I am bit new to C#. I am working on a Database application and I need to execute a query say a SELECT and load it in to some sort of table view. Then I want to double click on a result and get it loaded to my original data entry form. Can someone tell me the way that I should follow? Dont waste your time to add coding etc. Simply the steps would be enough. A link to a good resource is also be OK :)

+3  A: 

Have a look at SqlCommand, SqlDataAdapter and DataTable to retrieve data from the DB. Assuming SQL server, otherwise other DB providers are also available and implement the same API.

For Window Forms look at DataGridView, you can bind a DataTable to it and it will display the data in the DataTable

You can find an example over here

Philip Fourie
+1.. This is what I want :)
Chathuranga Chandrasekara
Then please mark this reply as an answer to help others. Thanks.
Braveyard
Looking at Chathuranga's acceptance rate I am sure he will eventually accept the right answer. Most likely he is confirming this is indeed the correct/best answer after the tried it out..
Philip Fourie
A: 

ADO.NET

SUMMARY: ADO.NET is a data-access technology that enables applications to connect to data stores and manipulate data contained in them in various ways. It is based on the .NET Framework and it is highly integrated with the rest of the Framework class library. The ADO.NET API is designed so it can be used from all programming languages that target the .NET Framework, such as Visual Basic, C#, J# and Visual C++.

adatapost
+1  A: 

Loot at some samples:

Future Readings:

  • Data Access Application Block @MSDN
  • Various Object Relational Mappers (LinqToSQL, Entity Framework, NHibernate etc)
Yury Skaletskiy