當前位置:首頁 » 存儲配置 » 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方法進行存放的。

熱點內容
在控制台輸出sql語句 發布:2024-04-26 01:08:12 瀏覽:431
動畫java 發布:2024-04-26 01:02:40 瀏覽:11
得力文件夾5302 發布:2024-04-26 00:21:32 瀏覽:90
您的個人文件夾 發布:2024-04-26 00:03:12 瀏覽:67
睿雲伺服器功能介紹 發布:2024-04-25 23:59:51 瀏覽:570
標致5008怎麼連接安卓 發布:2024-04-25 23:25:08 瀏覽:793
安卓下載管理器哪個好 發布:2024-04-25 23:22:48 瀏覽:442
考試系統源碼php 發布:2024-04-25 23:09:46 瀏覽:136
磁碟禁止訪問 發布:2024-04-25 22:53:48 瀏覽:289
多線程ftp上傳 發布:2024-04-25 22:41:36 瀏覽:115