asp相關及防止table變形的方法.

來源:互聯網
上載者:User

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 ");

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.