ASP function library (all functions can be called directly, which is very convenient) 8

Source: Internet
Author: User
Tags field table

'*************************************** ***********
'Function ID: 0045 [insert Field Values in the database]
'Function name: intertbvalue
'Usage: create a data table
'Parameter: connstrs ---- database link string
'Parameter: tabnamestr ---- data table name
'Parameter: cvarrstr ---- field table (written in fname1 # value | fname2 # value |...) do not write "|"
'Parameter: sqltype ---- SQL statement type (0 access 1 MSSQLServer)
'Fname, value description: field name, Field Value
'Return value: true if the insert operation is successful, otherwise false
'Example: intertbvalue (basicdb (3), "CS", "fa # T | FB # c | FC # N #")
'*************************************** ***********
Public Function intertbvalue (byval connstrs, byval tabnamestr, byval cvarrstr, byval sqltype)
Intertbvalue = false
On Error goto 0
On Error resume next
Dim def_kh_l, def_kh_r, filarray, valuearray, temparraya, temparrayb, tempsqlstr1
Def_kh_l = ""
Def_kh_r = ""
Temparraya = Split (cvarrstr, "| ")
For Fai = lbound (temparraya) to ubound (temparraya)
Temparrayb = Split (temparraya (FAI ),"#")
If (FAI <> ubound (temparraya) then
Filarray = filarray & "[" & temparrayb (0) & "],"
Valuearray = valuearray & "'" & temparrayb (1 )&"',"
Else
Filarray = filarray & "[" & temparrayb (0) & "]"
Valuearray = valuearray & "'" & temparrayb (1 )&"'"
End if
Next
Tempsqlstr1 = "insert into [" & tabnamestr & "] (" & filarray & ") values (" & valuearray &")"
Set fu1_conn = server. Createobject ("ADODB. Connection ")
Fuyun conn.open connstrs
Fu1_conn.execute tempsqlstr1
Fuyun conn.close
Set fuyun conn = nothing
If err. Number = 0 then
Intertbvalue = true
End if
On Error goto 0
End Function
'*************************************** ***********
'Function ID: 0046 [used to prevent garbled Characters During cookie writing]
'Function name: codecookie
'Usage: use cookies to prevent Garbled text writing
'Parameter: Str ---- string
'Return value: sorted string
'Example:
'*************************************** ***********
Public Function codecookie (STR)
If isnumeric (STR) Then STR = CSTR (STR)
Dim newstr
Newstr = ""
For I = 1 to Len (STR)
Newstr = newstr & ASCW (mid (STR, I, 1 ))
If I <> Len (STR) Then newstr = newstr & ""
Next
Codecookie = newstr
End Function
'*************************************** ***********
'Function ID: 0047 [used to prevent garbled reading of cookies]
'Function name: decodecookie
'Usage: use cookies to prevent garbled reading
'Parameter: Str ---- string
'Return value: sorted string
'Example:
'*************************************** ***********
Public Function decodecookie (STR)
Decodecookie = ""
Dim newstr
Newstr = Split (STR, "")
For I = lbound (newstr) to ubound (newstr)
Decodecookie = decodecookie & chrw (newstr (I ))
Next
End Function
'*************************************** ***********
'Function ID: 0048 [check whether the user name and password are correct]
'Function name: decodecookie
'Usage: Check whether the user name and password are correct
'Parameter: connstrs ---- database link string
'Parameter: tabnamestr ---- data table name
'Parameter: tumc ---- User Name field name
'Parameter: cumc ---- User Name
'Parameter: tcumm ---- user password field name
'Parameter: cumm ---- User Password
'Parameter: tuid ---- user ID (ID) field name
'Return value: the user ID is returned if the detection succeeds. Otherwise, an empty string is returned.
'Example:
'*************************************** ***********
Public Function ckusmcmm (byval connstrs, byval tabnamestr, byval tumc, byval cumc, byval tumm, byval cumm, byval tuid)
Ckusmcmm = ""
On Error goto 0
On Error resume next
Set sfu_conn = server. Createobject ("ADODB. Connection ")
Set sfu_rs = server. Createobject ("ADODB. recordset ")
Sfu_conn.open connstrs
Sfu_ SQL _str = "select" & tuid & "," & tumc & "," & tumm & "from" & tabnamestr
Sfu_rs.open sfu_ SQL _str, sfu_conn, 1, 1
If sfu_rs.recordcount> 0 then
Do while not sfu_rs.eof
If (sfu_rs (tumc) = cumc) and (exmw (sfu_rs (tumm) = cumm) then
Ckusmcmm = sfu_rs (tuid)
Exit do
End if
Sfu_rs.movenext
Loop
End if
Sfu_rs.close
Sfu_conn.close
Set sfu_rs = nothing
Set sfu_conn = nothing
On Error goto 0
End Function
'*************************************** ***********
'Function ID: 0049 [an integer of the generation time]
'Function name: getmytimenumber ()
'Usage: an integer of the generation time
'Parameter: lx ---- the type of the time integer
'Lx = 0 to minute Lx = 1 to hour Lx = 2 to day Lx = 3 to month
'Return value: the integer of the generation time (minimum to minutes)
'Example:
'*************************************** ***********
Public Function getmytimenumber (LX)
If Lx = 0 then getmytimenumber = year (date) * 12*30*24*60 + month (date) * 30*24*60 + Day (date) * 24*60 + hour (time) * 60 + minute (time)
If Lx = 1 then getmytimenumber = year (date) * 12*30*24 + month (date) * 30*24 + Day (date) * 24 + hour (time)
If Lx = 2 then getmytimenumber = year (date) * 12*30 + month (date) * 30 + Day (date)
If Lx = 3 then getmytimenumber = year (date) * 12 + month (date)
End Function
'*************************************** ***********
'Function ID: 0050 [obtain all the subtopic strings of the topic and separate them with commas (,)]
'Function name: gtlmfunlm
'Usage: obtain all the subtopic strings of the topic and separate them with commas (,).
'Parameter: lmid ---- column code
'Parameter: connstrarray ---- column data link string
'Return value: subcolumn strings are separated by commas (,).
'Example: HH = "data table link string | parent column field name | table name"
'Example: gtlmfunlm (22, basicdb (3) & "| ftitid | titid | tits ")
'*************************************** ***********
Public Function gtlmfunlm (byval lmid, byval connstrarray)
Dim lmstrxx, zdbz, NLM
Zdbz = false
Lmstrxx = ""
Atempstr = gtlmfunlm_whil (lmid, connstrarray)
Lmstrxx = lmstrxx & atempstr
If limit Rev (atempstr, ",")> 0 then
Do while not zdbz
Btempstr = gtlmfunlm_fj (atempstr, connstrarray)
Lmstrxx = lmstrxx & btempstr
If btempstr = "" Then zdbz = true
Atempstr = btempstr
Loop
Else
Lmstrxx = atempstr
End if
Lmstrxx = trim (lmstrxx)
If lmstrxx <> "" Then if mid (lmstrxx, Len (lmstrxx), 1) = "," then lmstrxx = mid (lmstrxx, 1, Len (lmstrxx)-1)
Gtlmfunlm = lmstrxx
End Function
Public Function gtlmfunlm_whil (byval lmidstr, byval connstrarray)
Pptemp = Split (connstrarray, "| ")
Gtlmfunlm_whil = ""
Set telm_conn = server. Createobject ("ADODB. Connection ")
Set telm_rs = server. Createobject ("ADODB. recordset ")
Telm_conn.open pptemp (0)
Telm_ SQL _str = "select" & pptemp (1) & "," & pptemp (2) & "from" & pptemp (3) & "where (" & pptemp (1) & "= '" & lmidstr &"')"
Telm_rs.open telm_ SQL _str, telm_conn, 1, 1
If telm_rs.recordcount> 0 then
Do while not telm_rs.eof
Gtlmfunlm_whil = gtlmfunlm_whil & trim (telm_rs (pptemp (2 )))&","
Telm_rs.movenext
Loop
End if
Telm_rs.close
Telm_conn.close
Set telm_rs = nothing
Set telm_conn = nothing
End Function
Public Function gtlmfunlm_fj (byval STR, byval connstrarray)
Dim templjid
Templjid = ""
If trim (STR) <> "then
Fjtemp = Split (STR ,",")
For I = lbound (fjtemp) to ubound (fjtemp)
If trim (fjtemp (I) <> "then
Templjid = templjid & gtlmfunlm_whil (fjtemp (I), connstrarray)
End if
Next
End if
Gtlmfunlm_fj = templjid
End Function

%>

Related Article

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.