<
html
>
< head >
< title > JS </ title >
< script language = " javascript " >
var conn = new ActiveXObject( " ADODB.Connection " );
conn.Open( " Provider=SQLOLEDB.1; Data Source=.; User ID=sa; Password=sa; Initial Catalog=test " );
var rs = new ActiveXObject( " ADODB.Recordset " );
var sql = " select * from userinfo " ;
rs.open(sql, conn);
shtml = " <table width='100%' border=1> " ;
shtml += " <tr bgcolor='#f4f4f4'><td>姓名</td><td>性别</td><td>年龄</td><td>电话</td><td> 地址</td></tr> " ;
while ( ! rs.EOF)
... {
shtml += "<tr><td>" + rs("uname") + "</td><td>" + rs("sex") + "</td><td>" + rs("age") + "</td><td>" + rs("tel") + "</td><td>" + rs("addr") + "</td></tr>";
rs.moveNext;
}
shtml += " </table> " ;
document.write(shtml);
rs.close();
rs = null ;
conn.close();
conn = null ;
</ script >
</ head >
< body >
</ body >
</ html >
< head >
< title > JS </ title >
< script language = " javascript " >
var conn = new ActiveXObject( " ADODB.Connection " );
conn.Open( " Provider=SQLOLEDB.1; Data Source=.; User ID=sa; Password=sa; Initial Catalog=test " );
var rs = new ActiveXObject( " ADODB.Recordset " );
var sql = " select * from userinfo " ;
rs.open(sql, conn);
shtml = " <table width='100%' border=1> " ;
shtml += " <tr bgcolor='#f4f4f4'><td>姓名</td><td>性别</td><td>年龄</td><td>电话</td><td> 地址</td></tr> " ;
while ( ! rs.EOF)
... {
shtml += "<tr><td>" + rs("uname") + "</td><td>" + rs("sex") + "</td><td>" + rs("age") + "</td><td>" + rs("tel") + "</td><td>" + rs("addr") + "</td></tr>";
rs.moveNext;
}
shtml += " </table> " ;
document.write(shtml);
rs.close();
rs = null ;
conn.close();
conn = null ;
</ script >
</ head >
< body >
</ body >
</ html >