views:

53

answers:

1

Hi,

QUESTION 1 - What .NET classes should I be looking at to help me read / update some data in a database, but assuming I'm not using LINQ or Entity Framework. That is if you drop back to the core .net framework what are the key classes to use.

In particular something that lets me access data from table X via use of C#/object type approach (as opposed to SQL)? I just need to do things like:

  • r1 = record from Table X where the description = "xyz"
  • r2 = records from Table X where TableX.ref_id = TableY.id

QUESTION 2 - If there no existing .net classes for this beyond going to LINQ / Entity Framework, then can I ask is there a way say, to do a SQL search in a table and identify 1 specific record, and then load this into a .net class that represents the row? e.g. has the same attributes in the class instance as in the database? Which .Net classes would let me do this. If this isn't possible then I assume it's a matter of creating your own data class and writing a manual function to load the data into it?

thanks

+9  A: 

You want to use ADO.NET:

ADO.NET is an object-oriented set of libraries that allows you to interact with data sources. Commonly, the data source is a database, but it could also be a text file, an Excel spreadsheet, or an XML file. For the purposes of this tutorial, we will look at ADO.NET as a way to interact with a data base.

Andrew Hare
yup - straight up, "old-style" ADO.NET will do just fine :-)
marc_s
Ok - so having a quick look through the classes it seems that DataSet and RecordSet are two of the key classes?
Greg