哪吒机器人提醒:

提醒:康节互联
【标题】在Excel中执行sql语句
【摘要】刚刚做了个小项目,客户为更新方便,要求用excel做为数据存储工具,前台页面可以对excel中的数据进行搜索。解决方案当然是excel中执行sql。微软的东西就是好用,用.net连excel超级简单。 string filenameurl = new system.web.ui.page().server.mappath("~\\app_data\\data.xls"); string strconn = "provider=microsoft.jet.oledb.4.0;" + "data source=" + filenameurl + ";extended properties='excel 8.0; hdr=yes; imex=1'"; oledbconnection conn = new oledbconnection(strconn); conn.open(); oledbcommand cmd = new oledbcommand(sql, conn); oledbdatareader dr = cmd.executereader(); while (dr.... (04-16 23:59)