用QueryTable向excel批量匯入資料

2021-08-22 18:25:08 字數 629 閱讀 7500

前面寫過兩篇excel操作的文章,有朋友質疑大批量資料下的效能問題,這個時候最好用批量複製的方法,可以用excel的querytable來直接查詢資料庫,但是必須引用com元件。

參考**:

using system;

using system.collections.generic;

using system.text;

using system.reflection;

using excel=microsoft.office.interop.excel;

//////直接匯出資料到excel

///

///連線字串

///查詢語句

///檔名

///表名

static

void exportdatatoexcel( string connectionstring, string sql, string filename, string sheetname)

catch (exceptionex)

finally }

} }

用js向xsl 加入變數

操作方式就是用js向xsl 加入變數 然後在xsl檔案中使用該變數引數 eg 1 在js中如下 xmldoc new activexobject msxml2.domdocument.3.0 xmldoc.async false xmldoc.load xml context.xml 要宣告為自由格...

用ADO向excel批量匯入數

和前面一篇用oledb的方法類似,我們可以用ado從recordset物件向excel批量插入資料,這個方法無法自動複製欄位名。我們需要引用ado和excel的com物件 參考 c code using system using system.collections.generic using sy...

用ADO向Excel批量匯入資料

和前面一篇用oledb的方法類似,我們可以用ado從recordset物件向excel批量插入資料,這個方法無法自動複製欄位名。我們需要引用ado和excel的com物件 參考 如下 using system using system.collections.generic using system...