Home > php教程 > php手册 > body text

netBook_tool.htm

WBOY
Release: 2016-06-21 09:11:55
Original
883 people have browsed it

本工具用于解决部分环境不能操作系统对话框的问题



来源



<script><br/>var dbpath = location.href.replace(/file:[/]+([A-Z]:.*[/])([^/]+)/,"$1");<br/><br/>function connect(db_name) {<br/> var dbc = new ActiveXObject("ADODB.Connection");<br/> var dbcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +db_name;<br/> dbc.Open(dbcon);<br/> return dbc;<br/>}<br/><br/>function query(sql) {<br/> var conn = connect(dbpath+"netBook.mdb"); // 连接数据库<br/> conn.Execute(sql);<br/> conn.Close();<br/>}<br/><br/>function splitData() {<br/> name = document.all.sfile.value;<br/> moveData(name,dbpath+"netBook.mdb","");<br/> query("update data set cote=0 where cote not in (select id from itemlist)");<br/>}<br/><br/>function addslashes(s) {<br/> return s.replace(/'/g,"''");<br/>}<br/><br/>// 复制db1的数据到db2<br/>function moveData(db1,db2,exrp) {<br/> if(! exrp) exrp = "";<br/> conn1 = connect(db1);<br/> conn2 = connect(db2);<br/> rs = conn1.Execute("select * from data "+exrp);<br/> while(!rs.EOF) {<br/> conn2.Execute("insert into data values ("+rs("id").value<br/> +","+rs("cote").value<br/> +",'"+rs("author").value+"'"<br/> +",'"+addslashes(rs("title").value)+"'"<br/> +",'"+addslashes(rs("content").value)+"'"<br/> +",'"+rs("type").value+"'"<br/> +",'"+rs("soruce").value+"'"<br/> +")");<br/> rs.MoveNext();<br/> }<br/> rs.Close();<br/> conn1.Close();<br/> conn2.Close();<br/>}<br/></script>



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template