完整 asp 数据库 代码 (access,mssql)'本文章提供这款asp 数据库 连接 代码 是一款可以与mssql server与access 数据库 连接的文件,包括有最简单的连接方法。 完整 asp教程 数据库 教程 代码 (access,mssql) '本文章提供这款asp 数据库 连接 代码 是一款可
完整asp数据库代码(access,mssql) '本文章提供这款asp数据库连接代码是一款可以与mssql server与access数据库连接的文件,包括有最简单的连接方法。
完整asp教程数据库教程代码(access,mssql)
'本文章提供这款asp数据库连接代码是一款可以与mssql server与access数据库连接的文件,包括有最简单的连接方法。
set cOnn=server.createobject("adodb.connection")
cOnnstr="provider=microsoft.jet.oledb.4.0;data source="&server.mappath("/www.111cn.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
%>