locked
How sql connection, data reader fetch data from sql server RRS feed

  • Question

  • i need full details like how sql connection, data reader fetch data from sql server. sql server store data in disk. so my question is how c# program interact with sql server to fetch data. what is internal story. if possible please redirect me to relevant article which give me many internal details. i want to understand the flow. thanks
    Thursday, October 6, 2016 2:01 PM

Answers

All replies

  • Why?  You are asking generic questions in the forums and this is not the place for such broad questions. If you want to see how SqlConnection and DataReader work then go look at the code. There is no better way to figure out what is going on with it.

    Michael Taylor
    http://www.michaeltaylorp3.net

    Thursday, October 6, 2016 2:31 PM
  • i just like to know the steps taken by dotnet program to interact with sql server db to fetch data. it is not possible to know what happen internally just looking at their code.

    if you know the steps then please tell me.

    Sunday, October 16, 2016 3:21 PM
  • i just like to know the steps taken by dotnet program to interact with sql server db to fetch data. it is not possible to know what happen internally just looking at their code.

    if you know the steps then please tell me.

    You want to know what you are talking about, then I suggest you find an ADO.NET forum. No C# developer would ever care about what you are talking about. 
    Sunday, October 16, 2016 4:50 PM
  • "just like to know the steps taken by dotnet program to interact with sql server db to fetch data"

    If you're referring to what code you would write to do this then it depends upon the data access technology you'll use. MSDN has complete examples for each of these approaches along with some suggestions on when to choose each option.

    DataReader

    DataSet

    Entity Framework

    Pluralsight also provides some courses on using some of this.

    If you're instead interested in learning exactly how SqlConnection, SqlCommand and other types work then you have no choice but to go look at the source. The implementation details change over time and therefore the only way to know how they work is to look at the source code.

    Sunday, October 16, 2016 7:39 PM
  • i like to know what internally happens when we use ado.net data reader or data set class to fetch data from sql server db ?

    how hand shaking done and what are the components of sql server is requested by c# program to get the data from disk because sql server store the data in disk ultimately.

    so please redirect me to some article which explain this internal story in details. thanks

    Monday, October 17, 2016 2:39 PM
  • There are no articles beyond the basics of how ADO.NET works. You need to look at the source code to understand how ADO.NET works. You can google for how SQL stores data on disk. This is completely unrelated to ADO.NET however as SQL works with much more than .NET. For questions related to exactly how SQL works please post in the SQL forums.
    Monday, October 17, 2016 3:01 PM
  • >so please redirect me to some article which explain this internal story in details. thanks

    SQL Server is a client/server relational database management system.

    So, your code uses an API like ADO.NET, which communicates with SQL Server over the network using a network protocol called the Tabular Data Stream Protocol, or TDS.  This network protocol is documented here

    http://download.microsoft.com/download/9/5/E/95EF66AF-9026-4BB0-A41D-A4F81802D92C/[MS-TDS].pdf

    But it mostly boils down to the client sending SQL queries to SQL Server, and SQL Server returning results. 

    Many books have been written on how SQL Server stores and retrieves data an performs query processing.  Here's an overview from Books Online Query Processing Architecture

    David


    David http://blogs.msdn.com/b/dbrowne/

    Monday, October 17, 2016 4:23 PM