您的位置:程序门 -> .net技术 -> c#



怎样能过代码将excel导入sqlserver中


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


怎样能过代码将excel导入sqlserver中[已结贴,结贴人:rainyubin]
发表于:2007-05-29 16:27:32 楼主
rt   excel是一个固定的格式   要将这个添加在这个模板中的数据导入到sqlserver中   应该怎么做?看到了很多 "select       *       from       [sheet1$] "这样的查询   都是全部查询   没有在excel中定位查询的   请教大家   谢谢!
发表于:2007-05-29 17:05:011楼 得分:0
急待解决   自己先顶!
发表于:2007-05-29 17:19:582楼 得分:0
大家帮帮忙吧   真的很急   还可以开帖加分!
发表于:2007-05-30 08:40:413楼 得分:10
没有,
你可以用记录集过滤的功能实现
发表于:2007-05-30 08:53:264楼 得分:10
study
发表于:2007-05-30 09:26:005楼 得分:15
如果不能直接在excel里实现条件查询,那你可以试一下把它读入到dataset再对dataset进行条件查询,这样可以了吧。
发表于:2007-05-30 11:08:276楼 得分:10
顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶
我也想问这个问题。
发表于:2007-05-30 11:15:047楼 得分:15
采用ole方式读入到dataset,然后写入数据库即可
发表于:2007-05-30 18:04:348楼 得分:0
ok   解决了
这样
public   dataset   exceltods(string   path)      
{      
string   strconn   =   "provider=microsoft.jet.oledb.4.0; "   +   "data   source= "+   path   +   "; "+   "extended   properties=excel   8.0; ";
oledbconnection   conn   =   new   oledbconnection(strconn);
conn.open();
string   strexcel   =   " ";
oledbdataadapter   mycommand   =   null;
strexcel= "select   *   from   [技術者経歴書$] ";
mycommand   =   new   oledbdataadapter(strexcel,   strconn);
dataset   ds   =   new   dataset();
mycommand.fill(ds, "data ");
conn.close();
return   ds;
}
发表于:2007-05-30 18:07:589楼 得分:0
http://community.csdn.net/expert/topic/5570/5570636.xml?temp=.9675409
这里还有一个问题   麻烦大家帮忙看看   谢谢了!
发表于:2007-07-18 15:25:0910楼 得分:0
收藏


快速检索

最新资讯
热门点击