ASP related and prevent table deformation method.

Source: Internet
Author: User

1. Methods to prevent table deformation:

The main is to set a style scheme in table: as follows

Style= "Table-layout:fixed;word-wrap:break-word"

Code example: the contents of a table are not distorted

<table width= "98%" border= "0" cellpadding= "0" cellspacing= "1" bgcolor= "#BFD0E2" class= "CSS" style= "Table-layout: Fixed;word-wrap:break-word ">

</table>

2.ASP operation related, add, delete, modify, inquire

<%
' Data increase, delete, change, check
' Definition of some basic variables
Dim P_id,p_code,p_name,p_telphone,p_addrees,actiontype,execvalue,tablename
' Table name
Tablename=sys_exttablename
' Type
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 ")" to establish a database connection
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 () ' Close the connection, put the connection into the connection pool
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 () ' Close the connection, put the connection into the connection pool
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. On the connection, for the return value after execution, the page's feedback processing

Conn.execute Sql,execvalue (parameter description: SQL for executed SQL statement, Execvalue for return value)

<%

' Get the message handled
Hit_msg=trim (Request ("hitmsg"))
If IsNumeric (hit_msg) Then
Hit_msg=cint (HIT_MSG)
Else
Hit_msg=-1
End If

%>

' Show tips

<% if Hit_msg>0 Then
%>
Operation successful
<%
ElseIf Hit_msg=0 Then
%>
Operation failed
<%
Else
%>

<%
End If
%>

4. Execute Stored Procedure methods

Set Rs=conn.execute ("exec Pro");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.