如何使用JavaScript來寫ASP程序
發(fā)表時(shí)間:2024-02-02 來源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]<%@Language="JavaScript" %> <% function OpenDB(dbname) var connstr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+S...
<%@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");
//特殊字符:+,%,&,=,?等的傳輸解決辦法.客戶端字符是經(jīng)過escape編碼的
//所以服務(wù)器端先要經(jīng)過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();
}
%>