ADO.NET flowchart questions part 2

The following flowchart includes some code for Insert and update/delete selction: ADO flowchartAre there different ways of deleting a records? I thought Insert, update, and delete) use something like Update("Insert   .... Delete.... Update....")  which is not included here.

Q1: If there are different ways of doing this, could you please show me both ways? Once using Update("Insert   .... Delete.... Update....") method and once .Delete, .Insert, .Update methods?

Q2: I wonder if you could also add some demo code for other 3 boxes (SqlConnection, SqlAddapter, SqlDataset) shown on this image, where applicable?

Basically, I want have one set of code makes this work.

In case needed:
NewRow = dataSet.Tables("Table Name").NewRow
		NewRow("Column Name") = Val
		dataSet.Tables("Table Name").Rows.Add(NewRow)

		Dim Foundresults() As DataRow = dataSet.Tables("TName").Select(filter)
		Foundresults(i)(columnIndex) = newValue

Open in new window

Thank you.
After posting this question, I located the following:
"In addition to the InsertCommand, UpdateCommand, and DeleteCommand, TableAdapters are created with methods that can be executed directly against the database. These methods (TableAdapter.Insert, TableAdapter.Update, and TableAdapter.Delete) can be called directly to manipulate data in the database. This means you can call these individual methods from your code instead of calling TableAdapter.Update to handle the inserts, updates, and deletes that are pending for the associated data table.
If you do not want to create these direct methods, set the TableAdapter's GenerateDbDirectMethods property to false (in the Properties window). Additional queries added to the TableAdapter are standalone queries — they do not generate these methods. (at"
 which relates to my first question. Despite this, it would be nice to have sample codes from you.
LVL 34
Mike EghtebasDatabase and Application DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jacques Bourgeois (James Burger)PresidentCommented:
Yes, there are many different ways of doing things.
ADO.NET is very powerful, but at the expense of a lot of little details that make it hard to grasp from the start. It is also a set of complementary technologies. You have to be careful not to mix them as you seem to be doing, which is perfectly understandable.

For instance, your chart works with DataSet and DataTable objects. They are not the same thing as a TableAdapter, and although there are similitudes, you have to decide which of the 2 technologies you prefer to use.

1. The usual Insert, Update and Delete commands still need to be used at the database level. But they are sometimes hidden from you, depending on your level as a programmer and the complexity of the tasks that you have to perform on the database.

2. A DataSet is the equivalent of a database (tables linked together with relations), but in memory, not in a file. A DataTable can be a standalone table in memory, or is one of the tables in the DataSet. You can get more about these in an article I wrote on the subject. They are most often created from the database through a DataAdapter (the SqlDataAdapter in your diagram), that executes Command objects (not displayed in the diagram) running over a Connection (the SqlConnection in your case).

They are the most basic ways of working with databases in .NET and are at the heart of ADO.NET.

Because they are basic tools, they are sometimes awkward to work with. For instance, all their values are of type Object. It's harder to work with an Object than it is working with a String, a Date or an Integer type value. To alleviate these difficulties, Microsoft has created over the years different tools that hide the basics and makes it easier to work with databases.

3. The TableAdapter is one of these tools. So are typed datasets, LINQ, Data entities.


I do not know where you got your chart from, but this is definitively something that is not worth much in itself. You need a better grasp of the whole thing and of the different ways of working with data.

I suggest that you start with the Microsoft ADO.Net Overview. You will also find sample code in there. Getting all the basics from one place is, in my opinion, the best way to get started. Reading stuff here and there, you will have problems putting the pieces together and untangle the different technologies available.

Once you have a better understanding of how everything falls together, you will be in a better position to chose one technology and concentrate on it.
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Thank you for good information and advise. I definitely study Overview link.
Because I like to see relationships of ADO components visually, I am also interested in UML of the classes used in this technology.

Taking about table adapter, somewhere I read, it is not a part of ADO. It is rather a part of .Net Farmework. I am not at a place to distinguish their differences yet, I just mentioned because I was reading about it without having a full grasp of what it meant.

I am looking for UMLs relating to ADO.NET. If you know any, please let me know.


Jacques Bourgeois (James Burger)PresidentCommented:
You are moving fast on that one :-)

UML is used for design. The same way that you create relationships between tables in a database, with rules that define how they relate one to each other, UML helps you create relationships between classes. Fundamentally, they have a lot in common. In fact, some of the technologies I mentioned before, such as data entities, are a way to "translate" database structures into class structures. In UML, this is called a class diagram. When you compare a UML class diagram to a database schema or relationships or whatever it is called depending on the database that you use, they are very similar.

But UML goes a long way beyond that. UML not only maps relations between classes, but also takes into consideration the users, the computers/servers, security, all the components of a complex IT system. It is a "language" that enables you to represent a whole system, hardware as well as software, and see what works and what does not in the whole environment. It can tell you that "this" won't work because user "somebody" is required to access such table, but he won't be able to do it because he does not have access to the server on which that table is stored. This is not something that you need in most situations. It becomes useful mainly in big systems.

Unless you are using the expensive higher edition of  Visual Studio or external tools, UML is out of your reach. The equivalent of a class diagram is available in Visual Studio Professional and higher, but that is only a small part of UML. And you are not talking about ADO.NET then, you are talking about high level design tools.

The closest thing I can see to UML in ADO.NET are data entities. Once again, an overview, available as ADO.NET Entity Data Model Tools is a good starting point. This is not really UML, because UML is a standard independent of the platform and goes a lot further than simple mapping between database and classes, but is it the closest you can get to it as far as coding in .NET is concerned.

As for TableAdapter not being part of ADO.NET, it depends on who you are talking with. Even in Microsoft closed circles, it is something presented as a part of ADO.NET, and sometimes as something over ADO.NET. As far as I am concerned, ADO.NET is about DataSet, DataTable, DataAdapter, DataReader and Command/Connection objects. As a programmer who needs fine controls over the link between his applications and his databases, this is all I use. They require a little more code and considerations than "helper" tools such as the TableAdapter do, but they enable you to do anything you want, efficiently and with top performance. So I am of that school who sees external tools such as the TableAdapter as being outside of ADO.NET.

But other programmers, for whom these external tools are sufficient and are all they use, these are all ADO.NET is about. Microsoft, for some reasons, is not very clear on that subject. Some discussions about ADO.NET are only about Datasets and DataTables. But they are pushing so heavily on Data entities that it is sometimes presented as being an extension if not part of ADO.NET. Coke is the thing as they say. But for me, the thing is a nice plank of black walnut. The meaning is in the eyes of the beholder (it this means something in English, which is only a second language for me).

By the way, note that although TableAdapters are still supported, they have been replaced by LINQ in Visual Studio 2008, and then by Data entities in Visual Studio 2010 (or to be precise, Visual Studio 2008 SP1). If I wanted to explore that avenue, I would go for Data entities instead of TableAdapters. They have held their nose up from 2010 to 2014, so they look like the Graal that Microsoft has been after since they "invented" the DataControl in the middle of the 90's. You still encounter TableAdapter all over the place, simply because the Internet is a cemetery where old things still live. Data entities are today's fad... until another one replaces them.

If you are serious and are not stuck in impossible deadlines, a Connection/Command/DataReadreader/custom class is the way to go.

This is only my opinion, the same way that some people will think that capitalism is better than god. But others will tell you that communism is even better than capitalism.

Who is right?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Mike EghtebasDatabase and Application DeveloperAuthor Commented:
I really appreciate your generous comments and advises. With iPhone, for example, I do not have to know how it works; so long as, I am able to call or text a message using it. But, with ADO.NET (currently I am taking as course in a college), I want to truly understand it. The course requirements are not that hard if I want just to learn some definitions and use some sample codes etc. I want to learn from A to Z of it everything about it.

On the UML (static with no dependencies on events, system, processes etc) vs UML + Sequence diagram (like in real life solution with a specific project), I want use static UML only just to show the classes involved in UML style short notations (instead of typing rather extensive classes) to show how they classes relate.

I will use visual studio 12 (I think it has UML diagramming capability) to replace what presently I have done in Excel or word. I will run them by some experts like yourself and find out how I can improve them a bit at a time to have fairly close visual representation of how ADO.NET classes generically work together and possibly with objects outside ADO.Net.

The text book we have goes back and fort and confusing the hell out of me and possibly some fellow classmates. It seems most people just winking it. My background is in data and it is very important for me to have a good understanding of the subject no matter how long it takes.

I will post my UML tryout diagram tomorrow to see how it turns out to be.

Thank you,

Jacques Bourgeois (James Burger)PresidentCommented:
Yes, Visual Studio has a class diagram feature similar to UML, although it does not follow the standard.

Project...Add New Item...Class Diagram.

You can build the diagram through right click operations, and this will generate the basic code for the classes.

Or if you already have classes, simply dragging a class or a complete project from the Solution Explorer will create the diagram for you.
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Hi James,

How do you locate SqlCommand class for example to include it with a uml?

Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Hi James,

I have a followup question posted on ADO.NET at:

I appreciate for any comment you may add to it.  BTW, my statement about TableAdapter not being a part of ADO.NET apparently is not correct.


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.