在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
复制代码 代码如下: <script language="javascript"> //用 JavaScript 写服务器端连接数据库的代码示例 var conn = new ActiveXObject("ADODB.Connection"); conn.Open("DBQ=c:\\a.mdb;DRIVER={Microsoft Access Driver (*.mdb)};"); var rs = new ActiveXObject("ADODB.Recordset"); var sql="select * from friends_infor"; rs.open(sql, conn); shtml = "<table width='100%' border=1>"; shtml +="<tr bgcolor='#f4f4f4'><td>au_id</td><td>au_lname</td><td>au_fname</td></tr>"; while(!rs.EOF) { shtml += "<tr><td>" + rs("friend_id") + "</td><td>" + rs("friend_name") + "</td><td>" + rs("friend_nickname") + "</td></tr>"; rs.moveNext; } shtml += "</table>"; document.write(shtml); rs.close(); rs = null; conn.close(); conn = null; </script> |
请发表评论