We can easily work with SQL Server databases with the help of System.Data.SqlClient
library in C#.
We can return values from stored procedures or we can write sql commands by hardcoding them in C# code.
Then we pass the result to a SqlDataReader
to read the values.
But I am really wondering what SQL Server开发者_StackOverflow中文版 returns to C#.
C# makes the call to SQL Server and SQL Server gives something (XML, JSON or whatever it is) to C# on return.
What is this thing really? And how can we get only this thing if we want to read it through manually ourselves?
I believe SQL Server at least used to use TDS for its data transfer. I don't know whether it still does - and using it directly would make your code very brittle in the face of changes within SQL Server. The whole point of having client libraries is to isolate you from the intricacies of the protocol.
What benefit are you trying to derive from reading through this manually, over (say) using SqlDataReader
, which is about as low-level as most applications will ever need?
精彩评论