ASP連接access數(shù)據(jù)庫例程

發(fā)布時(shí)間:2006-04-18 22:57:40   瀏覽人數(shù): 525770 次  
  關(guān)鍵字: access數(shù)據(jù)庫 - 本站搜索 - Google搜索 - Baidu搜索 - Yahoo搜索 - sougo搜索
ASP連接access數(shù)據(jù)庫例程
注意:要運(yùn)行上述ACCESS例程請(qǐng)先下載數(shù)據(jù)庫,放在db 或 rwdata文件夾下。請(qǐng)將例程放在根目錄下。
<%
Dim mode
mode=request.form("text4")
if mode=1 then
name=request.form("text1")
age=request.form("text2")
addr=request.form("text3")
if not isnumeric(age) then response.write "age must be number!try again":response.end
age=clng(age)
end if
'********************************************************************
' 與AccessDB相關(guān)的連接信息
' 可以參照它建立您的數(shù)據(jù)庫連接
'********************************************************************
Dim conn,rs,dbpath
Set conn=Server.CreateObject("ADODB.Connection")
Set rs=Server.CreateObject("ADODB.RecordSet")
dbpath=Server.MapPath("rwdata/db_test_com.mdb")
conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ="&dbpath
'********************************************************************
'********************************************************************

dim strsql
'********************************************************************
' 讀數(shù)據(jù)庫相關(guān)操作
sub readdb()
strsql="select * from test"
rs.open strsql,conn,1,1
if rs.EOF then response.write "no record at all":exit sub
response.write "

"
response.write "
"
for i=0 to rs.Fields.Count-1
response.write "
"
next
response.write "
"
while not rs.EOF
response.write "
"
for i=0 to rs.Fields.Count-1
response.write "
"
next
response.write "
"
rs.MoveNext
wend
response.write "
"&rs.Fields(i).Name&"
"&rs.Fields(i).Value&"
"
rs.Close
end sub
'********************************************************************


'********************************************************************
' 寫數(shù)據(jù)庫相關(guān)
sub insertdata()
strsql="INSERT INTO test(name,age,addr) VALUES('"&name&"',"&age&",'"&addr&"')"
rs.Open strsql,conn,1,3
end sub
'********************************************************************

if mode=1 then
call insertdata()
response.write "insert ok!"
elseif mode=2 then
call readdb()
end if

'********************************************************************
' 釋放數(shù)據(jù)庫連接對(duì)象
set rs=nothing
set conn=nothing
%>







name:
age:
city:






注意:要運(yùn)行上述ACCESS例程請(qǐng)先下載數(shù)據(jù)庫,放在rwdata文件夾下。請(qǐng)將例程放在根目錄下。




上一篇:空間生效后如何通過Leapftp上傳網(wǎng)頁?
下一篇:FTP工具,空間生效后如何通過flashfxp上傳網(wǎng)頁?

旗下網(wǎng)站:耐思智慧 - 淘域網(wǎng) - 我的400電話 - 中文域名:耐思尼克.cn 耐思尼克.top

耐思智慧 © 版權(quán)所有 Copyright © 2000-2025 IISP.COM,Inc. All rights reserved

備案號(hào)碼: 粵ICP備09063828號(hào)  公安備案號(hào): 公安備案 粵公網(wǎng)安備 44049002000123號(hào)  域名注冊(cè)服務(wù)機(jī)構(gòu)許可:粵D3.1-20240003 CN域名代理自深圳萬維網(wǎng)

聲明:本網(wǎng)站中所使用到的其他各種版權(quán)內(nèi)容,包括但不限于文章、圖片、視頻、音頻、字體等內(nèi)容版權(quán)歸原作者所有,如權(quán)利所有人發(fā)現(xiàn),請(qǐng)及時(shí)告知,以便我們刪除版權(quán)內(nèi)容

本站程序界面、源代碼受相關(guān)法律保護(hù), 未經(jīng)授權(quán), 嚴(yán)禁使用; 耐思智慧 © 為我公司注冊(cè)商標(biāo), 未經(jīng)授權(quán), 嚴(yán)禁使用

法律顧問:珠海知名律師 廣東篤行律師事務(wù)所 夏天風(fēng) 律師

主站蜘蛛池模板: 久久综合色之久久综合| 人妻va精品va欧美va| 久久精品2020| 欧美性大战久久久久久久| 国产一区二区精品久久凹凸 | 精品久久亚洲中文无码| 国产精品亚洲欧美大片在线观看| 中文字幕在线不卡精品视频99| 欧美性受一区二区三区| 亚洲色欲久久久综合网东京热| 精品国产av一二三四区| 国产60部真实乱| 91人成网站色www免费下载| 夫妇交换3中文字幕| 一本色道久久88—综合亚洲精品| 日韩精品电影一区亚洲| 亚洲精品视频在线| 看黄a大片免费| 午夜国产精品久久影院| 黄色一级毛片免费看| 国产精品久久国产三级国不卡顿| 91精品久久久久久久久久| 在线精品小视频| a级在线观看免费| 日产乱码卡1卡2卡三免费| 九一在线完整视频免费观看| 樱花草www日本在线观看| 免费国产成人午夜电影| 精品无码一区二区三区| 国产91精品一区二区麻豆亚洲| 香蕉视频网站在线| 国产综合在线观看视频| av色综合网站| 天堂资源在线www中文| 中文字幕日韩专区| 日日噜噜噜夜夜爽爽狠狠| 久久人妻内射无码一区三区| 日韩欧美一区黑人vs日本人| 亚洲最新在线视频| 毛片永久新网址首页| 又粗又大又猛又爽免费视频|