如何使用JAVASCRIPT来写ASP程序
类别: ASP教程
<%@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();
}
%>
<%
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();
}
%>
- 上一篇: 无组件生成BMP验证码
- 下一篇: 学会在ASP中使用存储过程
-= 资 源 教 程 =-
文 章 搜 索