2015年6月21日 星期日

ppt列印

步驟1:檔案/列印

步驟2:列印項目-->投影片

步驟3:勾選”配合紙張調整大小”

步驟4:印表機/內容

步驟5:排版/多張合一(選四)

步驟6:按下確定然後列印,就可以囉~

2015年6月7日 星期日

用其它的 Table 來更新資料(Update From Table)

UPDATE table1
      SET table1.col = table2.col1
FROM table2 WHERE table2.oldCol = table1.col


Oracle寫法
create table  Table_New as select * from  Table_Old
SQL Server寫法
 select   *   into   Table_New    from   Table_Old

2015年6月5日 星期五

網頁載入等待效果

引用

最近網頁載入資料比較多,點擊後給使用者就是白板很不友好,想了很久找了些資料,在網頁載入中顯示等待畫面給客戶,頁面載入完成自動隱藏等待效果。

在網頁後臺cs代碼:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ShowLoanding();
//.....
//你的資料載入代碼
Thread.Sleep(1000);//執行緒停留1秒,也可以不要。
}
}

//顯示載入進度
private void ShowLoanding()
{
Response.Write("
");
Response.Write(" Loading...");
Response.Write("
");
Response.Write("");
Response.Flush();
}

在網頁aspx代碼之後加入如下代碼:(目的隱藏等待效果)

padding: 0px" >

等待效果就是在網頁中間出現一個等待提示和動畫,頁面載入完成自動消失。當然動畫圖像和提示文字自己可以在代碼中修改。

2015年6月2日 星期二

好網址

wearoeric

https://wearoeric.wordpress.com/category/asp-net/

利用ActiveX控件InetCtls.Inet在ASP中實現

http://www.loliman3000.com/tech/2fe141cb3d60bf7d6f681998.php

元件的開發與使用

http://www.ravs.ntct.edu.tw/know/show.asp?QUESTIONID=152

ISO相關
https://proj.ftis.org.tw/isdn/Question/Detail/5FE2B6ACB8A5FE8D

DNS 快取記錄清空

引用

注意:此問題只會發生在使用 IE 瀏覽器的時候,其他版本瀏覽器無此問題。
如果只是本機的 DNS 快取問題,我們可以透過以下指令就能將快取住的 DNS 清空:
ipconfig /flushdns
指令執行完後,本機的 DNS 快取記錄就會被清空,這時任何應用程式要查詢 DNS 時就會重新向本機網路設定指定的 Name Server 進行查詢。不過,一個鮮為人知的秘密就是 IE 其實自己還內建一個 DNS 快取機制,所以就算你將本機系統的 DNS 快取清除,其實在 IE 內還有一份快取,而這份快取幾乎是無法透過任何指令操作的,此問題困擾我多年,直到最近透過微軟技術支援中心的協助才得以解決。
為了解決在開發時期 IE 會對所有 DNS 快取的問題,必須新增三個特殊的機碼值如下:
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"DnsCacheEnabled"=dword:00000000
"DnsCacheTimeout"=dword:00000000
"ServerInfoTimeOut"=dword:00000000
另外我再提供透過 reg.exe 設定的指令如下:
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "DnsCacheEnabled" /t REG_DWORD /d 0 /f 
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "DnsCacheTimeout" /t REG_DWORD /d 0 /f 
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "ServerInfoTimeOut" /t REG_DWORD /d 0 /f
如果你想要回覆預設值,只要將這三個機碼移除即可:
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"DnsCacheEnabled"=-
"DnsCacheTimeout"=-
"ServerInfoTimeOut"=-
以下是透過 reg.exe 指令的語法:
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "DnsCacheEnabled" /f 
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "DnsCacheTimeout" /f 
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v "ServerInfoTimeOut" /f
這三個機碼 ( DnsCacheEnabled, DnsCacheTimeout, ServerInfoTimeOut ) 你用 regedit 是找不到的,所以必須手動新增這三個機碼才行,加入後設定立即生效,且 IE 也就不會再對任何 DNS 進行快取了。

ASP.NET 取得使用者及伺服器 環境變數

http://devco.re/blog/2014/06/19/client-ip-detection/
在撰寫網站程式的時候,有時候會需要依照使用者的環境狀態作一些調整,這時你必須要有方法得知使用者電腦軟體使用狀態,你就可以下面方法 ex: Request.Browser.Browser 得知使用者的瀏覽器,來變更調整你的程式動作。
取得使用者的IP: Request.UserHostAddress
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim bc As HttpBrowserCapabilities = Request.Browser
Response.Write("Browser Capabilities:
")
Response.Write("Type = " & bc.Type & "
")
Response.Write("Name = " & bc.Browser & "
")
Response.Write("Version = " & bc.Version & "
")
Response.Write("Major Version = " & bc.MajorVersion & "
")
Response.Write("Minor Version = " & bc.MinorVersion & "
")
Response.Write("Platform = " & bc.Platform & "
")
Response.Write("Is Beta = " & bc.Beta & "
")
Response.Write("Is Crawler = " & bc.Crawler & "
")
Response.Write("Is AOL = " & bc.AOL & "
")
Response.Write("Is Win16 = " & bc.Win16 & "
")
Response.Write("Is Win32 = " & bc.Win32 & "
")
Response.Write("Supports Frames = " & bc.Frames & "
")
Response.Write("Supports Tables = " & bc.Tables & "
")
Response.Write("Supports Cookies = " & bc.Cookies & "
")
Response.Write("Supports VB Script = " & bc.VBScript & "
")
Response.Write("Supports JavaScript = " & bc.JavaScript & "
")
Response.Write("Supports Java Applets = " & bc.JavaApplets & "
")
Response.Write("Supports ActiveX Controls = " & bc.ActiveXControls & "
")
Response.Write("CDF = " & bc.CDF & "
")
Dim loop1, loop2 As Integer
Dim arr1(), arr2() As String
Dim coll As NameValueCollection
       ' Load ServerVariable collection into NameValueCollection object.
        coll = Request.ServerVariables
        ' Get names of all keys into a string array.
arr1 = coll.AllKeys
For loop1 = 0 To arr1.GetUpperBound(0)
  If Server.HtmlEncode(coll.GetValues(loop1)(0)) <> "" Then
       Response.Write("Key: _" & loop1 & "_" & arr1(loop1) & ": " & Server.HtmlEncode(coll.GetValues(loop1)(0)) & "
")
  End If
'arr2 = coll.GetValues(loop1) ' Get all values under this key.
'For loop2 = 0 To arr2.GetUpperBound(0)
'Response.Write("Value ++" & loop2 & "++" & CStr(loop2) & ": " & Server.HtmlEncode(arr2(loop2)) & "
")
'Next loop2
Next loop1
End Sub
--- 執行的結果如下:----
Browser Capabilities:
Type = IE7
Name = IE
Version = 7.0
Major Version = 7
Minor Version = 0
Platform = WinXP
Is Beta = False
Is Crawler = False
Is AOL = False
Is Win16 = False
Is Win32 = True
Supports Frames = True
Supports Tables = True
Supports Cookies = True
Supports VB Script = True
Supports JavaScript = True
Supports Java Applets = True
Supports ActiveX Controls = True
CDF = False
Key: _0_ALL_HTTP: HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:*/* HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:zh-tw HTTP_HOST:localhost:2788 HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) HTTP_UA_CPU:x86
Key: _1_ALL_RAW: Connection: Keep-Alive Accept: */* Accept-Encoding: gzip, deflate Accept-Language: zh-tw Host: localhost:2788 User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) UA-CPU: x86
Key: _3_APPL_PHYSICAL_PATH: C:\Documents and Settings\Jerry\function_test\
Key: _4_AUTH_TYPE: NTLM
Key: _5_AUTH_USER: WINNER\Jerry
Key: _7_LOGON_USER: WINNER\Jerry
Key: _8_REMOTE_USER: WINNER\Jerry
Key: _18_CONTENT_LENGTH: 0
Key: _28_LOCAL_ADDR: 127.0.0.1
Key: _29_PATH_INFO: /function_test/Default.aspx
Key: _30_PATH_TRANSLATED: C:\Documents and Settings\Jerry\function_test\Default.aspx
Key: _32_REMOTE_ADDR: 127.0.0.1
Key: _33_REMOTE_HOST: 127.0.0.1
Key: _35_REQUEST_METHOD: GET
Key: _36_SCRIPT_NAME: /function_test/Default.aspx
Key: _37_SERVER_NAME: localhost
Key: _38_SERVER_PORT: 2788
Key: _39_SERVER_PORT_SECURE: 0
Key: _40_SERVER_PROTOCOL: HTTP/1.1
Key: _42_URL: /function_test/Default.aspx
Key: _43_HTTP_CONNECTION: Keep-Alive
Key: _44_HTTP_ACCEPT: */*
Key: _45_HTTP_ACCEPT_ENCODING: gzip, deflate
Key: _46_HTTP_ACCEPT_LANGUAGE: zh-tw
Key: _47_HTTP_HOST: localhost:2788
Key: _48_HTTP_USER_AGENT: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Key: _49_HTTP_UA_CPU: x86