asp_数据库操作封装
一、conn.asp
<%
'@Language="VBSCRIPT" CODEPAGE=65001
'meta http-equiv="Content-Type" content="text/html; charset=gb2312"
' 936 utf-8
class TDB
function qry(byval sqlquery)
dim adoConn,adoRS
set adoConn=server.createobject("ADODB.connection")
adoConn.open "provider=microsoft.jet.oledb.4.0;data source=" & Server.MapPath(".") & "/sys.mdb"
set adoRS=server.createobject("ADODB.RecordSet")
adoRS.open sqlquery,adoConn,1,3 'support movelast (adOpenKeySet,adLockOptimistic)
'set adoRS=adoConn.execute(sqlquery) 'don't support movelast
'
dim rtnstr
rtnstr="<?xml version='1.0' encoding='gb2312' standalone='yes' ?>" & chr(13)& chr(10)
rtnstr=rtnstr & "<rs>" & chr(13)& chr(10)
irow=0
adoRS.movefirst
do while not adoRS.Eof
rtnstr=rtnstr & " <r" & cstr(irow) & ">" & chr(13)& chr(10)
for i=0 to adoRS.Fields.Count-1
rtnstr=rtnstr & " <" & adoRS.Fields(i).name & ">" & chr(13)& chr(10)
rtnstr=rtnstr & "<![CDATA[ " & adoRS.Fields(i) & " ]]>
相关文档:
LBound() 函数: 返回指定的数组维可用的最小下标。
UBound() 函数: 返回指定的数组维可用的最大下标。
InStr([start, ]string1, string2[, compare]) 返回字符或字符串在另一个字符串中第一次出现的位置
InStrRev()函数 返回某字符串在另一个字符串中最后出现的位置
CDate() 函数可把一个合法的日期和时间表达式转换为 ......
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%response.ContentType ="application/vnd.ms-excel"
%>
<%
Set xlApplication = Server.CreateObject("Excel.Application") '调用excel对象
xlApplication.Visible = False '无需打开excel
xlApplication.SheetsInN ......
ASP如何连接数据源?(系统DSN)中建立的数据源?
ASP怎么建立连接,不是OLEDB方式,用ODBC中的“用户DSN”建立的数据源进行连接?如何操作?
问题补充:我的是ODBC中的“用户DSN”不是“系统DSN”,“用户DSN”怎么连接?而且我的数据库有密码。
提问者:匿名
最佳答案
Set co ......
首先,他们的运行机制不同。asp是属于一种解释型的框架!是解释执行的,是脚本。asp.net是编译型的!最终会编程二进制的机器代码。从这一点来说,asp.net执行效率上要比asp高!
其次,asp只允许使用js或者vbs。而asp.net则不一样,只要符合公共语言运行库规范的语言,都可以使用!从这一点上来说,asp在底层操作上较asp.ne ......
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
if Request("MailtoAddress") <> "" then
msg = SendMail
(Request("SMTPServer"),Request("SMTPServerUserName"),Request("SMTPServerPassword"),
Request("MailDom ......