一、取得資料表 i 行 j 列的值 //建立並開啟資料庫連接 OleDbConnection conn=new OleDbConnection(); conn.ConnectionString=strConnectionString;//strConnectionString為資料庫連接字串 conn.Open(); string sql="select * from NewsClass order by ClassId desc";
我們儲存在資料庫中的內容是HTML格式的,但是有時候我們需要無格式的顯示這內容,這是用Regex實現的過濾。複製代碼 代碼如下:<% function nohtml(str) dim re Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="(\<.[^\<]*\>)" str=re.replace(str," ")
1、純粹的截取字串複製代碼 代碼如下:function cutstr(thestr1,strlen) dim l,t,c l=len(thestr1) if l<1 then exit function t=0 for dxy1=1 to l c=Abs(asc(Mid(thestr1,dxy1,1))) if c>255 then t=t+2 else t=t+1 end if if t>=strlen then thev=mid(thestr1,1,dxy1) exit
1.如何用Asp判斷你的網站的虛擬實體路徑 答:使用Mappath方法 p align=center font size=4 face=Arial b The Physical path to this virtual website is b font font color=#FF0000 size=6 face=Arial %= Server.MapPath()% font p 2.我如何知道使用者所用的瀏覽器 答:使用the
在 ASP 中使用 Request.ServerVariables("REMOTE_ADDR") 來取得用戶端的 IP 位址,但如果用戶端是使用Proxy 伺服器來訪問,那取到的就是Proxy 伺服器的 IP 位址,而不是真正的用戶端 IP 位址。要想透過Proxy 伺服器取得用戶端的真實 IP 位址,就要使用Request.ServerVariables("HTTP_X_FORWARDED_FOR") 來讀取。 不過要注意的事,並不是每個Proxy 伺服器都能用