[C#] Dapper查詢返回Datatable


Posted by mike-hsieh on 2023-09-20

.Net 許多套件只支援Datatable,但是現行很多都使用Dapper進行資料存取,所以紀錄一下轉換的方式。

public Datatable table()
{
   DataTable table = new DataTable("DT");
   var reader = conn.ExecuteReader("SELECT * FROM Orders");
   table.Load(reader);
   return table;
}

參考來源:
https://www.cnblogs.com/zyg316/p/9791607.html


#dapper #datatable #C#







Related Posts

覺得 JavaScript function 很有趣的我是不是很奇怪

覺得 JavaScript function 很有趣的我是不是很奇怪

[Vue3] 元件溝通術 props、emits、slot 、mitt怎麼用

[Vue3] 元件溝通術 props、emits、slot 、mitt怎麼用

Kotlin 學習社群 - Kotlin Tips

Kotlin 學習社群 - Kotlin Tips


Comments