| 网站首页 | 新闻中心 | 系统安全 | 网络安全 | 安全技术 | 下载中心 | 安全365社区 |
安全365
收藏本站
设为首页
会员登录:
站内搜索: 新闻中心 系统安全 网络安全 安全技术 下载中心
| 网络安全首页 | 信道安全 | 设备安全 | 协议安全 | Web安全 |
asp快速开发方法之数据操作
asp快速开发方法之数据操作
作者:未知 文章来源:巧巧读书 点击数: 更新时间:2007-9-18 1:14:34
e from "&tableName
            If isnumeric(id) and instr(id,",")=0 then
                sql = sql & " where "&DelField&" = "&id
            Else
                sql = sql & " where "&DelField&" in ("& id &")"
            End If
            Opendatabase
                conn.execute(sql)
            Closedatabase
            tempvalue=true
        Else
            tempvalue=false
        End If
        DeldataSql=tempvalue
    End Function
End Class
%>

以下是我的sql.asp文件,请自己进行增删

<%
'用于查询数据
Class DataTable
    '查出记录
    public Function SelectData(sql)
        If sql<>"" then
            opendatabase
            Rs.open sql,conn,1,1
            If not Rs.eof then
                Thedata=Rs.GetRows(-1)
                Closedatabase
            Else
                Closedatabase
            End If
        End If
        SelectData=Thedata
    End Function
    '查出记录条数
    public Function SelectDataNum(sql)
        If sql<>"" then
            Opendatabase
            Rs.open sql,conn,1,1
            If not Rs.eof then
                Thedata=Rs.GetRows(-1)
                Closedatabase
                Num=ubound(Thedata,2)
            Else
                Closedatabase
            End If
        End If
        SelectDataNum=Num
    End Function
    '使用select count(*) from tablename 查出记录有数
    public Function SelectCountNum(sql)
        If sql<>"" then
            Opendatabase
            Rs.open sql,conn,1,1
            If not Rs.eof then
                Thedata=Rs.GetRows(-1)
                Closedatabase
                Num=Thedata(0,0)
            Else
                Closedatabase
            End If
        End If
        SelectCountNum=Num
    End Function
    '将查询的数据全部生成隐藏值
    public Function GetHiddenData(sql)
        dim tempvalue
        If sql<>"" then
            Opendatabase
            Rs.open sql,conn,1,1
            If not Rs.eof then
                Thedata=Rs.getRows(-1)
                TheFieldCount=rs.fields.count
                For i=0 to TheFieldCount-1
                    TheFieldList = TheFieldList & Rs.fields(i).name & ","
                Next
                Closedatabase
                TheField = split(TheFieldList,",")
                For i=0 to TheFieldCount-1
                    tempvalue = tempvalue & "<input type=""hidden"" id="""&TheField(i)&""" name="""&TheField(i)&""" value="""&Thedata(i,0)&""" />"
                Next
            Else
                Closedatabase
            End If
        End If
        GetHiddenData=tempvalue
    End Function
    public Function UpdataSql(sql)
        If sql<>"" then
            Opendatabase
            conn.execute(sql)
            Closedatabase
        End If
    End Function
   
    public Function DeldataSql(tableName,DelField,id)
        dim tempvalue
        If tableName<>"" and id<>"" then
            sql="delete from "&tableName
            If isnumeric(id) and instr(id,",")=0 then
                sql = sql & " where "&DelField&" = "&id
            Else
                sql = sql & " where "&DelField&" in ("& id &")"
            End If
            Opendatabase
                conn.execute(sql)
            Closedatabase
            tempvalue=true
        Else
            tempvalue=false
        End If
        DeldataSql=tempvalue
    End Function
End Class
%>

上一页  [1] [2] 

文章录入:郝丽    责任编辑:郝丽 
  • 上一篇文章:

  • 下一篇文章: 没有了
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
     
     
     
    透彻掌握ASP分页技术
    JAVA一步一步的WEB编程关
    PHP开发中接收复选框信息
    数据库安全 关于Access数
    14招保护路由器安全的方
    华为路由器简单配置详解
    万能asp防注代码
    万能asp防注代码
    Win2003下Asp配置技巧
    用ASP生成静态Html文件
    站长邮箱:webmaster@anquan365.com
    联系电话:86-10-67634029 点击这里给我发消息

    Copyright © 2006-2008 www.anquan365.com 北京华安普特网络科技有限公司 版权所有