How to create Windows applications in VB.Net or ASP.Net
I would pick the one you like best and decide to optimize as soon as you find a bottleneck in using one or the other. If you're just planning a new application, it makes more sense to get it to work with Okay products than get bogged down in trying to choose the "best" approach.
a source to share
A The data reader will read the data in a progressive manner, allowing you to work with one line at a time, its fast and light weight, but mostly forward only.
The data adapter and dataset heavily use the DataReader to retrieve data and store the result in memory that populates the table, takes longer, but access and update thereafter is much faster until you save the data back to the database.
Use a datareader if speed is your thing, otherwise use a dataset as it is more readable and manageable.
a source to share
It is important to use this case. How are you going to use the data after marshaling it in your application?
If you only need to iterate over it, the DataReader has the lowest memory overhead for the technologies you listed.
The DataAdapter provides more options in exchange for more memory, and in particular will include the DataTable overhead. This is in exchange for a more user-friendly API.
The DataSet is the heaviest (before you get into typed datasets, at least) but provides the ability to get in-memory relationships between DataRows.
There are many possibilities versus cost in terms of memory and programming efficiency - memory is relatively cheap in many cases, and programmer time and code maintainability may be more important in the long run.
a source to share
Since it seems that you are looking for the effectiveness of the program. I would lean towards the business object class using a data reader as the accessor. This will give you the ability to build maintainable code and give you speed.
You can create an object using a method that iterates through the DataReader, as in the example below. It gives you all the speed, and in my opinion it is quite convenient. This is most likely what the DataSet type offers you, without the extra lines of code to generalize the functions needed to get the data.
something like that:
public class Table1
{
public int Col1 { get; set; }
public String Col2 { get; set; }
public List<Table1> GetTable1()
{
List<Table1> tableContents = new List<Table1>();
SqlCommand cmd = new SqlCommand("SELECT * FROM Table1");
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
tableContents.Add(new Table1
{
Col1 = (int)rdr["Col1"],
Col2 = (string)rdr["Col2"]
});
}
return tableContents;
}
}
There are many ways to do this, hope it helps
a source to share