ASP常用函数收藏乱七八糟未整理版(36)
On Error Resume Next
Dim strOrd
Select Case intDay
Case 1, 21, 31
strOrd = "st"
Case 2, 22
strOrd = "nd"
Case 3, 23
strOrd = "rd"
Case Else
strOrd = "th"
End Select
GetDayOrdinal = strOrd
End Function
%>
<%
Dim db
db = "dbms.mdb"
'******************************************************************
'执行sql语句,不返回值,sql语句最好是如下:
'update 表名 set 字段名=value,字段名=value where 字段名=value
'delete from 表名 where 字段名=value
'insert into 表名 (字段名,字段名) values (value,value)
'******************************************************************
Sub NoResult(sql)
Dim conn
Dim connstr
Set conn = Server.CreateObject("ADODB.Connection")
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
conn.Open connstr
conn.Execute sql
conn.Close
Set conn = Nothing
End Sub
'*******************************************************************
'执行select语句,返回recordset对象。该对象只读。也就是不能更新
'*******************************************************************
Function Result(sql)
Dim conn
Dim connstr
Dim rcs
Set conn = Server.CreateObject("ADODB.Connection")
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
conn.Open connstr
Set rcs = Server.CreateObject("ADODB.Recordset")
rcs.Open sql, conn, 1, 1
Set Result = rcs
End Function
'*******************************************************************
内容版权声明:除非注明,否则皆为本站原创文章。