I can't stand it today. Write a long SQL statement, write this paragraph, change can become SQL statement generation function

Source: Internet
Author: User
Tags chr
<!--#include file= "conn.asp"-->
<title>untitled document</title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<body>
<%dim Rs,sql,rsname
Set Rs=server.createobject ("Adodb.recordset")
On Error Resume Next
Sql= "SELECT * from Your_table"
Rs. Open SQL, Conn
Rsname=rs (0). Name
For i = 1 to RS. Fields.count-1
' RSNAME=RSNAME&AMP;CHR (9) &rs (i). Name
rsname=rsname& "," &rs (i). Name
Next
RSNAME=RSNAME&AMP;CHR (13)
Rs.close
Set rs=nothing
Conn.close
Set conn=nothing
Function E (W)
Dim h
Dim My_array,my_array1
My_array=split (W, ",")
My_array1=split (W, ",")
Dim I
For i=0 to UBound (My_array)
My_array (i) =my_array (i) & "=" &AMP;CHR (i) &AMP;CHR (a) &chr (a) &my_array (i) &AMP;CHR (i) &AMP;CHR (34) &AMP;CHR (39)
Next
For i=0 to UBound (My_array)
My_array1 (i) =CHR (&AMP;CHR) &AMP;CHR (a) &my_array1 (i) &AMP;CHR (a) &chr (a) &AMP;CHR (39)
Next
E= "<P>" &w& "<p>" & "Update:" & "<br>" & "Update your_table Set" & Join (My_array , ",") & "Where Condition" & "<p>" & "Insert:" & "<br>" & "INSERT INTO Your_table (" &w& ") VALUES ("&join (My_array1,", ") &") "
End Function
Response.Write E (rsname)%>
</body>

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.