当前位置:首页文章首页 IT学院 IT技术

教你数据库简单实现添加,显示,修改,删除的方法

作者:  来源:  发布时间: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)'修改前读取数据函数
if request("id")<>"" and request("act")="edit" and sl<>"" then'读取要修改的数据

'------------------生成SQL语句----------------小琦
                        zd_name="" '字段名子
'--------循环memo
                        For i = 1 To sl
                                zd_name=zd_name&"memo"&i&","       
                        next
'//--------循环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(){"'

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

response.write "}</script>"

end if
end function

function read_form(sl)'读取数据函数
if request("id")<>"" and request("act")="" and sl<>"" then'读取要查看的数据

'------------------生成SQL语句----------------小琦
'--------循环memo
                        For i = 1 To sl
                                zd_name=zd_name&"memo"&i&","       
                        next
'//--------循环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(){"'
'--------循环赋值
                        for each i in split(zd_name,",")
                        if rs(i)="" then kongge=" "'如果内容为空,则用空格代替
                                response.write "frm."&i&".parentElement.innerText="""&rs(i)&kongge&""";"'
                        next
'//--------循环赋值
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