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

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:705
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:968
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:676
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:828
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:737
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:1076
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:308
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:188
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:875
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:829