如何使用JavaScript来写ASP程序
今天图老师小编要向大家分享个如何使用JavaScript来写ASP程序教程,过程简单易学,相信聪明的你一定能轻松get!
%
function OpenDB(dbname)
{
var connstr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+Server.MapPath(dbname);
var conn = Server.CreateObject("ADODB.Connection");
conn.Open(connstr);
return conn;
}
var sResult = new Array();
var oConn = OpenDB("Data/Data.mdb");
//特殊字符:+,%,&,=,?等的传输解决办法.客户端字符是经过escape编码的
//所以服务器端先要经过unescape解码.
//Update:2004-6-1 12:22
var sql = "select SortName From Article_Sort order by OrderID";
var rs = oConn.Execute(sql);
while(!rs.EOF)
{
//unescape解决中文处理的问题.
Response.Write(unescape(rs("SortName").Value + "BR"));
rs.MoveNext();
}
%