How to get SQL result saved into a C# variable?

前端 未结 3 1309
日久生厌
日久生厌 2021-02-05 18:12

I have troubles finding out how to save an SQL result into a String or whatever type the result returns.

My SQL query is:

SELECT SUM(Length) FROM tbl_tes         


        
3条回答
  •  鱼传尺愫
    2021-02-05 18:48

    You need to connect C# to your Database through some of the available methods:

    1. LinQ to SQL
    2. ADO.NET
    3. LinQ to Entities

    I would think ADO.NET is the most basic and straightforward way to do it given you actual query.

提交回复
热议问题