<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
<%
var WEBConfig=
{
domain:"www.baidu.com",
conn:"Provider=Sqloledb;User ID=sa;Password=sa;Initial Catalog=391K;Data Source=.\\SQLEXPRESS;"
}
var DB={};
DB.ExecuteSQL=function(sql)
{
var Conn=Server.CreateObject("ADODB.Connection");
Conn.Open(WEBConfig.conn);
Conn.Execute(sql);
Conn.Close();
Conn=null;
}
DB.ADDRecord=function(sql,json)
{
var Rs=Server.CreateObject("ADODB.RecordSet");
Rs.Open(sql,WEBConfig.conn,3,2);
Rs.AddNew();
for(var inx in json){
Rs(inx).value=json[inx];
}
Rs.Update();
Rs.Close();
Rs=null;
}
DB.GET=function(p,pageSize,fileds,tableName,where,orderby){
var sql=null,arr=[];
if(p<=1)
{
sql="select top "+pageSize+" "+fileds+" from "+tableName + " where "+where+" order by "+ orderby;
}else{
sql="select top "+pageSize+" "+fileds+" from "+tableName + " where "+where+" and id not in(select top "+
((p-1)*pageSize)+" id from "+ tableName+" where "+where+" order by "+ orderby +") order by "+ orderby;
}
var Conn=Server.CreateObject("ADODB.Connection");
Conn.Open(WEBConfig.conn);
var Rs=Server.CreateObject("ADODB.RecordSet");
Rs.Open(sql,Conn,1,1);
while(!Rs.EOF)
{
var record={};
for(var i=0;i<Rs.Fields.Count;i++)
{
record[Rs.Fields.Item(i).Name]=Rs.Fields.Item(i).value;
}
arr.push(record)
Rs.MoveNext();
}
Rs.Close();
Rs=null;
Conn.Close();
Conn=null;
return arr;
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<ul>
<%
var arr=DB.GET(1,10,"softid,softname","softdown_softinfo","1=1","softID desc")
for(var i=0;i<arr.length;i++){
%>
<li>softid:<%=arr[i].softid%> softname:<%=arr[i].softname%></li>
<%
}
%>
</ul>
</body>
</html>