當前位置:首頁文章首頁 IT學院 IT技術(shù)

教你數(shù)據(jù)庫簡單實現(xiàn)添加,顯示,修改,刪除的方法

作者:  來源:  發(fā)布時間:2011-6-8 11:35:56  點擊:
'去掉最后的“,”
zd_name=left(zd_name,len(zd_name)-1)

'//------------------生成SQL語句----------------小琦

sql="Update pub_doc set "&zd_name&" where id="&request("id")&""
conn.execute(sql)

response.write "修改成功!"

Response.End()
end if
end function

function read_edit_form(sl)'修改前讀取數(shù)據(jù)函數(shù)
if request("id")<>"" and request("act")="edit" and sl<>"" then'讀取要修改的數(shù)據(jù)

'------------------生成SQL語句----------------小琦
                        zd_name="" '字段名子
'--------循環(huán)memo
                        For i = 1 To sl
                                zd_name=zd_name&"memo"&i&","       
                        next
'//--------循環(huán)memo

'去掉最后的“,”
zd_name=left(zd_name,len(zd_name)-1)

sql="select top 1 "&zd_name&" from pub_doc where id="&request("id")&""
'//------------------生成SQL語句----------------小琦
set rs = conn.execute(sql)'查詢

response.write "<script language=java script>"'寫java script的腳本
response.write "function read_data(){"'

'--------循環(huán)賦值
                        for each i in split(zd_name,",")
                                response.write "frm."&i&".value="""&Replace(Replace(Replace(rs(i)&"||",chr(13),"\n"),chr(10),"\n"),"||","")&""";"'
                        next
'//--------循環(huán)賦值

response.write "}</script>"

end if
end function

function read_form(sl)'讀取數(shù)據(jù)函數(shù)
if request("id")<>"" and request("act")="" and sl<>"" then'讀取要查看的數(shù)據(jù)

'------------------生成SQL語句----------------小琦
'--------循環(huán)memo
                        For i = 1 To sl
                                zd_name=zd_name&"memo"&i&","       
                        next
'//--------循環(huán)memo

'去掉最后的“,”
zd_name=left(zd_name,len(zd_name)-1)

sql="select top 1 "&zd_name&" from pub_doc where id="&request("id")&""
'//------------------生成SQL語句----------------小琦
set rs = conn.execute(sql)'查詢

response.write "<sc"+"ript language=java script>"'寫java script的腳本
response.write "function read_data(){"'
'--------循環(huán)賦值
                        for each i in split(zd_name,",")
                        if rs(i)="" then kongge=" "'如果內(nèi)容為空,則用空格代替
                                response.write "frm."&i&".parentElement.innerText="""&rs(i)&kongge&""";"'
                        next
'//--------循環(huán)賦值
response.write "}</scr"+"ipt>"
end if
end function

首頁 上一頁 [1] [2] [3] [4] [5]  下一頁 尾頁

文章評論

軟件按字母排列: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z