asp相关及防止table变形的方法.

1.防止Table变形的方法:

主要是设置table中的一个样式方案:如下

        STYLE="table-layout: fixed;word-wrap:break-word"

代码示例:table中的内容就不会变形了

<table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#BFD0E2" class="css" STYLE="table-layout: fixed;word-wrap:break-word">

</table>

2.Asp操作相关,增加,删除,修改,查询

<%
'数据增,删,改,查
'一些基本变量的定义
Dim p_id,p_code,p_name,p_telphone,p_addrees,actionType,execvalue,tablename
'表名
tablename=sys_exttablename
'类型
actionType=Trim(request("actionType"))
if actionType="padd" then
 p_id=""
 p_code=""
 p_name=""
 p_telphone=""
 p_address=""
 actionType="psave"
elseif actionType="pedit" then
    p_id=Trim(request("id"))
     set rs=server.CreateObject("ADODB.RecordSet")'建立数据库连接
   sqlpage="select * from "&tablename&" where id='"&p_id&"'"
    rs.open sqlpage,conn,1
     if not rs.eof then
          p_code=rs("code")
          p_name=rs("name")
          p_telphone=rs("telphone")
          p_addrees=rs("address")
   end if
    rs.close
    set rs=nothing
    CloseConn()'关闭连接,把连接放入到连接池
   actionType="pmodify"
elseif actionType="psave" then
    p_id=Trim(request.form("id"))
    p_code=Trim(request("code"))
    p_name=Trim(request("name"))
    p_telphone=Trim(request("telphone"))
    p_addrees=Trim(request("address"))
 'response.write p_id&p_code&p_name&p_telphone&p_addrees
     sql="insert into  "&tablename&"(code,name,telphone,address,intime,createtime,edittime,msgtype) values ('"&p_code&"','"&p_name&"','"&p_telphone&"','"&p_addrees&"',getdate(),getdate(),getdate        (),'"&sys_MsgType&"')"
          Conn.execute  sql,execvalue
         CloseConn()'关闭连接,把连接放入到连接池
          response.redirect "modeledit.asp?actionType=padd&HitMsg="&execvalue
elseif actionType="pmodify" then
           p_id=Trim(request("id"))
           p_code=Trim(request("code"))
           p_name=Trim(request("name"))
           p_telphone=Trim(request("telphone"))
           p_addrees=Trim(request("address"))
           sql="update  "&tablename&"  set code='"&p_code&"',    name='"&p_name&"',telphone='"&p_telphone&"',address='"&p_addrees&"',edittime=getdate() where   id="&p_id
            Conn.Execute  sql,execvalue
            Conn.close
             response.redirect "model.asp?HitMsg="&execvalue
elseif actionType="pcut" then
      p_id=Trim(request("id"))
      sql="update  "&tablename&"  set state=0 where id="&p_id
      Conn.Execute sql,execvalue
      Conn.close
       response.redirect "model.asp?HitMsg="&execvalue
end if
%> 

3.接上,对于执行后的返回值,页面的返馈处理

Conn.Execute sql,execvalue (参数说明: sql为执行的sql语句,execvalue为返回值)

<%

'取得提示信息的处理
hit_msg=Trim(request("HitMsg"))
if isnumeric(hit_msg) then
 hit_msg=cint(hit_msg)
else
 hit_msg=-1
end if

%>

'显示提示信息

     <% if hit_msg>0 then
     %>
        操作成功
     <%
        elseif hit_msg=0 then
     %>
        操作失败
     <%   
        else
     %>
      
     <%   
        end if
     %>

4.执行存储过程方法

    Set rs=Conn.execute("exec pro ");

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值