Solved

ADO.NET flowchart questions part 3

Posted on 2014-09-21
6
133 Views
Last Modified: 2014-09-28
Trying to make sense out of ADO.NET, I have summarized it in the attached 3-page doc file (under 300 words) with charts. Please add your valuable comments to it. I want to be corrected with wrong statements I may have made or my Figure 1 and 2 accurately depicting how ADO.NET works.

I am summarizing for my own understanding. There are a lots to read about it over the Web and books learn from; but I am finding them awfully confusing because there are very many similar terminologies and they jump back and forth with their descriptions.

Also, in page 3, please add some sample code you may want to share.

Thank you.
ADO-NET-EE1.docx
0
Comment
Question by:Mike Eghtebas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 11

Expert Comment

by:LordWabbit
ID: 40336187
This is probably the neatest way of using ado.net, although this method assumes that your SQL is clean and that the user has not used SQL injection.

    Private Function GetData(sql As String) As DataTable
        Dim con As SqlConnection = Nothing
        Dim command As SqlCommand = Nothing
        Dim adapter As SqlDataAdapter = Nothing
        Try
            con = New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("db").ConnectionString)
            con.Open()
            command = New SqlCommand(sql, con)
            adapter = New SqlDataAdapter(command)
            Dim table As New DataTable
            adapter.Fill(table)
            Return table
        Catch ex As Exception
            Return Nothing
        Finally
            If (IsNothing(con) = False) Then
                If (con.State = ConnectionState.Open) Then con.Close()
                con.Dispose()
            End If
            If (IsNothing(command) = False) Then
                command.Dispose()
            End If
            If (IsNothing(adapter) = False) Then
                adapter.Dispose()
            End If
        End Try
    End Function

Open in new window

0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 40337220
Hi LordWabbit,

In this figure:DataProvider
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 40337246
... In the above figure, does your solution applies to A or B?:
"The main function of Active Data Object (ADO) is to supply data to an application; it bridges the gap between the database and the application. It uses: A) DataAdapter with Dataset combination, B) DataAdapter w/o Dataset, C) DataReader, and D) TableAdapter which uses wizard plus some typed-code to handle the data flow."

I think it applies to option B because it is not building a dataset and data goes directly into a DataTable.

Please see the attached doc file for the entire text (less then 300 words).

Thanks,

Mike
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Accepted Solution

by:
LordWabbit earned 500 total points
ID: 40338732
Applies more to B, but you could load a data set with the data table, I always just found it a bit awkward working with a dataset with one data table.  Never been a fan of DataReaders - while you are working with them the connection is blocked, also the performance increase is negligible.  I read through your document, refers to pages which are not present.  Have you heard of the entity framework?  http://msdn.microsoft.com/en-us/data/ef.aspx
No one really uses ADO.Net directly anymore unless they need to talk to SQL older than 2005. (Which I sadly have to do).
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 40339360
Hi,

re:> No one really uses ADO.Net directly anymore...

I appreciate the info on this. The book I am studying will be discussing entity framework later. What I am learning though will serve me later to follow entity framework better.

I think, your code applies to option B only because your code is not discussing dataset (present with option A only).

The attached doc is the missing part (on oop). please read through and give me some feedback on it if you want it to.

about one data table: As you can see datatable collection implies that we can have more than one table in a dataset.

Question: Can we have more then on dataset? Where, a dataprovider creates/works with multiple dataset?

Thank you,

Mike
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 40339364
Here is the file:
ADO-NET-Sep22.docx
0

Featured Post

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question