當前位置:首頁 » 存儲配置 » list存儲數據

list存儲數據

發布時間: 2022-12-08 21:02:07

㈠ 怎麼將list<>保存到資料庫

就是寫文件啊,循環list string str = Guid.NewGuid().ToString(); string strPath = "C:\\Program Files\\" + str + ".xls"; FileStream fs = File.Create(strPath); StreamWriter sw = new StreamWriter(fs, Encoding.Unicode); string strLine = ""; // 寫入列標題 for (int i = 0; i < colNames.Length; i++) { string[] col = colNames[i].Split('='); strLine = strLine + col[1].ToString() + Convert.ToChar(9); } sw.WriteLine(strLine); strLine = ""; // 寫入報表數據 for (int i = 0; i < dt.Rows.Count; i++) { // for (int j = 0; j < colNames.Length; j++) { string[] col = colNames[j].Split('='); strLine = strLine + dt.Rows[i][col[0]].ToString() + Convert.ToChar(9); } sw.WriteLine(strLine); strLine = ""; } sw.Close(); fs.Close();

㈡ 資料庫中用什麼類型存儲List

List類型本身是可以存放任何對象的,也就是只要是數據都可以存儲的。
如:List.add(new Object());這個語句是不會報錯的。由於Object是任何對象的父類,所以任何的子對象都是可以被List通過add方法進行存放的。

熱點內容
如何開mod伺服器 發布:2025-09-24 09:36:47 瀏覽:480
php並發編程 發布:2025-09-24 09:15:23 瀏覽:58
25系列編程器 發布:2025-09-24 08:19:23 瀏覽:277
小米6換機熱點密碼是多少 發布:2025-09-24 08:08:00 瀏覽:27
c語言10的階乘 發布:2025-09-24 08:07:49 瀏覽:355
南寧少兒編程培訓 發布:2025-09-24 07:16:35 瀏覽:324
非易失存儲 發布:2025-09-24 06:59:14 瀏覽:494
安卓備用機哪裡買比較便宜 發布:2025-09-24 06:44:53 瀏覽:583
360壓縮解壓文件丟失 發布:2025-09-24 06:44:44 瀏覽:931
內網ip怎麼訪問內網伺服器地址 發布:2025-09-24 06:20:20 瀏覽:951