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
Solved

ADO.NET flowchart questions part 3

Posted on 2014-09-21
6
131 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
  • 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
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

840 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