nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
无标题文档 <script> <br />var objdbConn=new ActiveXObject("ADODB.Connection"); <br />var strdsn = "Driver={SQL Server};SERVER=.;UID=sa;PWD=123;DATABASE=PointCard"; <br />objdbConn.Open(strdsn); <br />var objrs=objdbConn.Execute("SELECT [head] FROM news"); <br />var fdCount=objrs.Fields.Count-1; <br />if(!objrs.EOF) <br />{ <br />document.write("<table border=1><tr>"); <br /> for (var i=0;i<=fdCount;i++) <br /> document.write("<td><b>"+objrs.Fields(i).Name+""); <br /> document.write(""); <br /> while(!objrs.EOF){ <br /> document.write("<tr>"); <br /> for (i=0;i<=fdCount;i++) <br /> document.write("<td valign='top'>"+objrs.Fields(i).Value+""); <br /> document.write(""); <br /> objrs.moveNext(); <br /> } <br /> document.write(""); <br /> } <br /> else <br /> document.write("数据库内没有记录!<br>"); <br /> objrs.Close(); <br /> objdbConn.Close(); <br /> </script>
回复讨论(解决方案)
new ActiveXObject("ADODB.Connection");
这个对象只有ie才支持,火狐不支持
Statement: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