如何使用JavaScript来写ASP程序
发表于:2007-06-30来源:作者:点击数:
标签:
%@Language=" Java Script" % % 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 sResu
<%@Language="
JavaScript" %>
<%
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();
}
%>
原文转自:http://www.ltesting.net