iT邦幫忙

0

用非強型別select出來(dapper)的資料放到dictionary有錯(編譯問題)

SKY 2023-09-02 15:25:38480 瀏覽
  • 分享至 

  • xImage

K_TX00的欄位有:
CREATE TABLE [dbo].[K_TX00] (
[Time] DATETIME NOT NULL,
[O] DECIMAL (7, 2) NOT NULL,
[H] DECIMAL (7, 2) NOT NULL,
[L] DECIMAL (7, 2) NOT NULL,
[C] DECIMAL (7, 2) NOT NULL,
[V] INT NOT NULL,
PRIMARY KEY CLUSTERED ([Time] ASC)
);

我是想把我select出來的資料放到dictionary裡面,
有預編就紅線了,
想問該怎麼改
https://ithelp.ithome.com.tw/upload/images/20230902/20141660ybLlBPZ5g6.png

SKY iT邦新手 5 級 ‧ 2023-09-02 17:22:44 檢舉
String sql = String.Format(@"SELECT * FROM K_TX00");
var res = conn.Query(sql).ToDictionary(m=>m.Time, m=>new Double[]{ m.O, m.H, m.L, m.C, m.V });

找到了~~ 不用麻煩各位了
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答