简体   繁体   中英

What does SQL Server return to C#

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 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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM