GOGO专业大尺度亚洲高清人体,清纯校花的被cao日常np,日本三级香港三级人妇99,亭亭玉立国色天香八戒,秋霞电影在线观看

ASP連接access數據庫例程

發布時間:2006-04-18 22:57:40   瀏覽人數: 745493 次  
  關鍵字: access數據庫 - 本站搜索 - - - -
ASP連接access數據庫例程
注意:要運行上述ACCESS例程請先下載數據庫,放在db 或 rwdata文件夾下。請將例程放在根目錄下。
<%
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相關的連接信息
' 可以參照它建立您的數據庫連接
'********************************************************************
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
'********************************************************************
' 讀數據庫相關操作
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
'********************************************************************


'********************************************************************
' 寫數據庫相關
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

'********************************************************************
' 釋放數據庫連接對象
set rs=nothing
set conn=nothing
%>







name:
age:
city:






注(zhu)意:要運行(xing)上述ACCESS例(li)程請先下載(zai)數據庫(ku),放(fang)(fang)在(zai)rwdata文件夾下。請將例(li)程放(fang)(fang)在(zai)根目錄下。




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

旗下網站:耐思智慧 - - - 中文域(yu)名:

耐思(si)智慧 © 版權所有 Copyright © 2000-2025 szjicheng.cn,Inc. All rights reserved

備案號碼:   公安備案號: 公安備案

聲明:本(ben)網站中所使(shi)用到的其(qi)他各種版(ban)(ban)權(quan)(quan)內(nei)容(rong)(rong),包括但不限(xian)于文章、圖片、視頻(pin)、音頻(pin)、字體等內(nei)容(rong)(rong)版(ban)(ban)權(quan)(quan)歸原作者所有(you),如權(quan)(quan)利(li)所有(you)人發現,請及時告(gao)知,以(yi)便我們刪除(chu)版(ban)(ban)權(quan)(quan)內(nei)容(rong)(rong)

本站程序(xu)界面、源代碼受相關法律保護(hu), 未經(jing)授(shou)權, 嚴禁使(shi)用; 耐思智(zhi)慧 © 為我公司注(zhu)冊商標(biao), 未經(jing)授(shou)權, 嚴禁使(shi)用

法律顧問: