我现在用的导入方法是:
string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1'";
OleDbConnection ExcelConn = new OleDbConnection(strCon);
try
{
string strCom = string.Format(sql);
ExcelConn.Open();
OleDbDataAdapter myCommand = new OleDbDataAdapter(strCom, ExcelConn);
DataSet ds = new DataSet();
myCommand.Fill(ds, "[" + tableName + "$]");
ExcelConn.Close();
ExcelConn.Dispose();
return ds;
}
catch
{
ExcelConn.Close();
ExcelConn.Dispose();
return null;
}
这种效率低 高手们有没其它的方法了!
因为是给客户用 所以大家不要说用什么自带的导入功能,只要代码的导入!
string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1'";
OleDbConnection ExcelConn = new OleDbConnection(strCon);
try
{
string strCom = string.Format(sql);
ExcelConn.Open();
OleDbDataAdapter myCommand = new OleDbDataAdapter(strCom, ExcelConn);
DataSet ds = new DataSet();
myCommand.Fill(ds, "[" + tableName + "$]");
ExcelConn.Close();
ExcelConn.Dispose();
return ds;
}
catch
{
ExcelConn.Close();
ExcelConn.Dispose();
return null;
}
这种效率低 高手们有没其它的方法了!
因为是给客户用 所以大家不要说用什么自带的导入功能,只要代码的导入!
解决方案 »
- VS2008 安装出现的问题 快来帮忙解决
- iframe里面输入的时候直接粘贴内存中的内容如何清除HTML代码
- 下拉菜单能不能绑定datalist啊?
- sql server2005开发版和企业版有什么区别?正式发布程序用哪个版本?sql server2005企业版有多少M?好区别下载!!!
- help:日期时间格式转换
- 已成功与服务器建立连接,但是在登录过程中发生错误。 (provider: 共享内存提供程序, error: 0 - 管道的另一端上无任何进程。)
- 根据数据表中的某个字段的特定值设定该行的底色,或者显示特定图片
- 怎么为textbox控件指定默认的button
- OleDbType.VarChar和OleDbType.VarWChar有什么区别?
- 隐藏uploadify控件按钮 js触发选择文件事件
- select标签赋值
- 求一份wmi开发的中文文档
create table #table (ID char(1),Name char(100))
INSERT INTO #table
select 1 as ID,'Nam1' as Name where not exists(select NULL from #table where ID=1)INSERT INTO #table
select 2 as ID,'Nam2' as Name where not exists(select NULL from #table where ID=2)INSERT INTO #table
select 3 as ID,'Nam3' as Name where not exists(select NULL from #table where ID=3)INSERT INTO #table
select 4 as ID,'Nam2' as Name where not exists(select NULL from #table where ID=4)INSERT INTO #table
select 5 as ID,'Nam2' as Name where not exists(select NULL from #table where ID=5)
INSERT INTO #table
select 5 as ID,'Nam2' as Name where not exists(select NULL from #table where ID=5)
INSERT INTO #table
select 5 as ID,'Nam2' as Name where not exists(select NULL from #table where ID=5)
INSERT INTO #table
select 5 as ID,'Nam2' as Name where not exists(select NULL from #table where ID=5)
INSERT INTO #table
select 5 as ID,'Nam2' as Name where not exists(select NULL from #table where ID=5)
INSERT INTO #table
select 5 as ID,'Nam2' as Name where not exists(select NULL from #table where ID=5)
select * from #table
drop table #table
改成oracel的试试
这个是最好的导入方式,而且验证重复性
一执行或者100条数据一执行,10000条数据一提交事务INSERT INTO #table
select 1 as ID,'Nam1' as Name where not exists(select NULL from #table where ID=1)