最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
完整asp数据库代码(access,mssql)
时间:2022-06-30 10:09:05 编辑:袖梨 来源:一聚教程网
set conn=server.createobject("adodb.connection")
connstr="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("/www.111com.net/data.mdb")
conn.open connstr
%>
<%
response.buffer = true
const msxmlversion=".3.0"
const cookiename = "netpic"
dim conn,connstr,datafile
startime = timer()
'可修改设置一:========================定义数据库类别,1为sql数据库,0为access数据库=============================
const issqldatabase = 0
'================================================================================================================
if issqldatabase = 1 then
'必修改设置二:========================sql数据库设置=============================================================
'sql数据库连接参数:连接名(sqllocalname)(本地用local,外地用ip)、用户名(sqlusername)、用户密码(sqlpassword)、数据库名(sqldatabasename)
const sqllocalname = "(local)"
const sqlusername = "sa"
const sqlpassword = "001225"
const sqldatabasename = "photo"
'================================================================================================================
datestring = array("getdate()","yyyy","m","d","hh","n","s","'")
connstr = "driver={sql server};uid=" & sqlusername & ";pwd=" & sqlpassword & ";database=" & sqldatabasename & ";server=" & sqllocalname & ";"
else
'必修改设置三:========================access数据库设置==========================================================
datafile = server.mappath("data/#photo.mdb")
'================================================================================================================
datestring = array("now()","'yyyy'","'m'","'d'","'h'","'n'","'s'","#")
connstr = "provider = microsoft.jet.oledb.4.0;data source = " & datafile
end if
'on error resume next
set conn = server.createobject("adodb.connection")
conn.open connstr
if err then
err.clear
set conn = nothing
response.write "数据库连接出错,请检查连接字串。"
response.end
end if
function checked(value1,value2)
checked = " value="&chr(34)&value2&chr(34)
if lcase(value1&"")=lcase(value2&"") then checked = checked & " checked"
end function
function selected(value1,value2)
selected = " value="&chr(34)&value2&chr(34)
if lcase(value1&"")=lcase(value2&"") then selected = selected & " selected"
end function
%>
相关文章
- 王者荣耀侦探能力大测试攻略 王者荣耀侦探能力大测试怎么过 11-22
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22