顯示具有 ASP 標籤的文章。 顯示所有文章
顯示具有 ASP 標籤的文章。 顯示所有文章

2013年4月22日 星期一

ASP 三元表示式

asp不支持三元运算符




Reference :
asp三元运算符怎么用_百度知道

asp switch case

Dim myNum
myNum = 5
Select Case myNum
Case 2
Response.Write("myNum is Two")
Case 3
Response.Write("myNum is Three")
Case 5
Response.Write("myNum is Five")
Case Else
Response.Write("myNum is " & myNum)
End Select




Reference :
ASP Tutorial - Select

2013年1月21日 星期一

ASP chekc if POST

if Request.ServerVariables("REQUEST_METHOD") = "POST" then
    Response.Write "post data ..."
end if




Reference :
Server Variables (Windows)

ASP check if variable is null (empty)



Reference :
Check if a string is empty

ASP conn.Execute(SQL) INSERT return auto_increment id

SQL = "INSERT INTO table (a, b, c, d) VALUES ('a', 'b', 'c', 'd')"
conn.Execute(SQL)
Set rsAdd = conn.Execute("SELECT @@IDENTITY")
idnum = rsAdd(0)
Set rsAdd = Nothing
conn.Close

Response.Write "Insert success :" & idnum




Reference :
SELECT LAST_INSERT_ID() in ExecuteScalar() returns 0 only : The Official Microsoft ASP.NET Forums

2013年1月14日 星期一

ASP Date Time

Response.Write FormatDateTime(Now(), 0)

Response.Write FormatDateTime(Now(), vbLongDate)


1 vbLongDate 長日期格式
2 vbShortDate
3 vbLongTime
4 vbShortTime 短時間格式


ASP page include file

可以引用 .html、.inc、... 檔案進來,但是用這個語法的頁面必須是 .asp



Reference :
ASP Including Files