⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myfunction.asp

📁 具有计划、任务、通告、公文、员工档案、等网络办公功能
💻 ASP
字号:
<SCRIPT RUNAT=SERVER LANGUAGE=VBScript>
'Option Explicit
'On Error Resume Next
dim conn

sub show_today()
	dim strDate
	strDate=Year(Now())&"年"&Month(Now())&"月"&Day(Now())&"日"
        Response.Write (strDate)
end sub
sub show_week(indate)
	dim strDate
	if isdate(indate) then
		select case weekday(indate)
		case 1:
			strDate="星期日"
		case 2:
			strDate="星期一"
		case 3:
			strDate="星期二"
		case 4:
			strDate="星期三"
		case 5:
			strDate="星期四"
		case 6:
			strDate="星期五"
		case 7:
			strDate="星期六"
		end select		
		Response.Write strDate
	end if
end sub
sub connect_db()
	dim DBPath1
	set conn = Server.createobject("adodb.connection")
	'if Err.number =0 then	
	'	Response.Write "ok,connect success!"
	'else
	'	Response.Write "err,not create adodb object!"
	'	Response.End 		
	'end if
	DBPath1=server.MapPath("../../db/#sdoa.asa")	
	'Response.Write DBPath1
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath1
	'Response.Write "connect success<BR>"
end sub

sub close_db()
	conn.Close()
	set conn=nothing 
end sub

sub get_recordset(rec)	
	set rec=server.createobject("adodb.recordset")	
end sub

function self_replace(str)
	dim temp_str
	temp_str=trim(str)
	self_replace=replace(temp_str,"'","’")
end function

function show_ymdTime(inTime)
	dim strOutTime
	if isdate(inTime) then
		strOutTime=year(inTime)&"-"&month(inTime)&"-"&day(inTime)
	end if
	show_ymdTime=strOutTime
end function

function show_content(content)
	dim strContent
	strContent=replace(content,chr(13),"<br>")
	strContent=replace(strContent," ","&nbsp;")
	show_content=strContent
end function

function deal_msg(topic,isnote,msg)
	dim strHref_tmp
	strHref_tmp="msg.asp?topic="&topic&"&msg="&msg&"&isnote="&isnote
	'Response.Write strHref_tmp
	'Response.End 
	Response.Redirect strHref_tmp
end function

sub database_error(conn)
    dim e
     if conn.Errors.Count=1 then 
        Response.Write "Error #" & Err.number & ":" & Err.description & "<br>"
    else
        for e = 0 to conn.Errors.Count-1 
           if conn.Errors(e) < 0 then 
               Response.Write "Error #"
           else
               Response.Write "Warming #"
           end if
           Response.Write conn.Errors(e).number & ":"
           Response.Write conn.Errors(e).description & "<br>"
           next
    end if
end sub

function alendth(str)
     dim i , j , k
     k = 0
	 i = len(str)
	 for j = 1 to i
	     if asc(mid(str,j,1)) > 255 or asc(mid(str,j,1)) < 0 then  
	         k = k + 1
	     end if
	 next
	 i = i + k
	 alendth = i
end function

function split_str1(str ,num,geShu)
	if alendth(str) <= num then
		split_str=server.HTMLEncode(str)
	else	
		dim i , str1 ,k
		i = 0
		k = 1
		str1 = ""
		while i < geShu and k <= geShu
		    str1 = str1 & mid(str,k,1)
		    if asc(mid(str,k,1)) > 255 or asc(mid(str,k,1)) < 0 then
		        i = i + 1
		    end if
		    i = i + 1
		    k = k + 1
		wend
		split_str = server.HTMLEncode(str1) & "..."
	end if
end function

function split_str(str ,num,geShu)
	if len(str) <= num then
		split_str=str
	else		
		split_str = left(str,geShu) & "..."
	end if
end function

function selected(req,reqvalue)	
	if trim(req)=trim(reqvalue) then
		selected=" selected"
	else
		selected=""
	end if
end function


function checked(req,reqvalue)	
	if trim(req)=trim(reqvalue) then
		checked=" checked"
	else
		checked=""
	end if
end function

function sqlstr(str)
	sqlstr="'" & replace(str,"'","''") & "'"
end function

function get_name(username)	
	dim strTemp_sql,strTemp_ors,name
	strTemp_sql="select name from userinf where username='"&trim(username)&"'"	
	set strTemp_ors=conn.Execute(strTemp_sql)
	
	if not strTemp_ors.EOF then
		name=trim(strTemp_ors("name"))
	end if		
	strTemp_ors.close()	
	set strTemp_ors=nothing	
	get_name=name	
end function

</SCRIPT>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -