明輝手游網(wǎng)中心:是一個(gè)免費(fèi)提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺(tái)!

如何使用JavaScript來寫ASP程序

[摘要]<%@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();
}
%>