無标题文档 頭>
<ボディ>
<スクリプト言語="JavaScript">
var objdbConn=new ActiveXObject("ADODB.Connection");
var strdsn = "Driver={SQL Server};SERVER=.;UID=sa;PWD=123;DATABASE=PointCard";
objdbConn.Open(strdsn);
var objrs=objdbConn.Execute("SELECT [head] FROM news");
var fdCount=objrs.Fields.Count-1;
if(!objrs.EOF)
{
document.write("
");
for (var i=0;i<=fdCount;i++)
document.write(""+objrs.Fields(i).Name+" | ");
document.write("
");
while(!objrs.EOF){
document.write("");
for (i=0;i<=fdCount;i++)
document.write(""+objrs.Fields(i).Value+" | ");
document.write("
");
objrs.moveNext();
}
document.write("
");
}
else
document.write("数架库内没有记录!
");
objrs.Close();
objdbConn.Close();
回复讨论(解决方案)
new ActiveXObject("ADODB.Connection");
这个对象只有ie才,火狐不支持