NPOI從資料庫中匯出到Excel

2021-06-16 08:40:40 字數 624 閱讀 3081

一,如何把資料庫的資料匯入到excel?

(1)可以使用多種方式,但是較好的一種是使用npoi。

(2)npoi的缺陷:只能在office2003中使用,office2007無法使用npoi,同時對於wps也不能使用。

(3)使用是要引入npoi的dll外部檔案,下面的**使用了簡單三層的思想。

二,把資料庫中的資料匯入到excel的具體步驟:

protected void button2_click(object sender, eventargs e)

//操作檔案流,寫入到excel中

using (stream stream = new filestream(@"g:\userinfoout.xls", filemode.openorcreate, fileaccess.readwrite))

response.write("匯出成功");

}catch (exception ex)

}

三 ,參考

(1),此種做法只能針對資料量較小的資料,對於資料很多的匯出,則不能使用這種方式。

把資料從tidb中匯出到mysql資料庫中

把資料從tidb中匯出到mysql資料庫中 docker ps 找出容器id 進入容器 docker exec it 44a9fa0f6c02 sh 發現是4000埠對映到了主機的3306埠 訪問tidb mysql h192.168.11.222 p 3306 u root p d common ...

從資料庫中匯出資料

首先開啟xp cmdshell許可權 exec sp configure show advanced options 1 reconfigure exec sp configure xp cmdshell 1 reconfigure 1,匯出資料到txt exec master.xp cmdshel...

從資料庫中匯出資料庫文件

select case when a.colorder 1 then d.name else end n 表名 a.colorder n 字段序號 a.name n 欄位名 case when columnproperty a.id,a.name,isidentity 1 then else end...