notepad++ 很好用

可是有時候 內建的文件切換器會跑掉,沒辦法貼在最右邊

如果先前已經是設定貼右,但是不小心拉成另外的視窗時,先把文件切換器最大化再還原就會跑回去了

notpad++ 畫面

文章標籤

bgm 發表在 痞客邦 留言(0) 人氣()

安裝KB3102810的更新檔之後就可以正常更新了
這個更新檔是在修更新卡住的Bug

64位元
32位元

官方支援文件(英文)

文章標籤

bgm 發表在 痞客邦 留言(0) 人氣()

使用模擬器時,透過微軟遠端連線 會因為OpenGL無法開啟 

只時需要寫一個Batch(cmd)檔

先關閉遠端連線 再開啟會用到OpenGL的程式 再連線回來就OK

 

tscon.exe %SESSIONNAME% /v /dest:console
"D:\Program Files\Microvirt\MEmu\MEmuConsole.exe" MEmu

bgm 發表在 痞客邦 留言(0) 人氣()

家裡因為有地下室 1樓 3樓 4樓

如果要用無線網路的話

需要能漫游

解決方法是將AP設定為同一個SSID

並將頻段設為 1,6,11

這樣訊號就不會互相干擾,傳輸的品質會比較穩定。

bgm 發表在 痞客邦 留言(0) 人氣()

 

用表格顯示 數字資料時,常會有表格欄位不夠寬 而自已斷行的情況

如下例

 

Stock Qty.

                 <--明明只有1個數字但是卻自己斷行了 

              1

 

網路上找到解法 http://w1ng.hk/smartforms-extra-space-after-number/

在smartforms中的變數設定輸出格式就可以了

把原來 &GT_ZSMM_RESVLAB-VMENG& 改成 &GT_ZSMM_RESVLAB-VMENG(C)&

下表是格式設定參數及說明

&symbol(Z)& Omit Leading Zeros 
&symbol(S)& Omit Leading Sign 
&symbol(<)& Display Leading Sign to the Left 
&symbol(>)& Display Leading Sign to the Right 
&symbol(C)& Compress Spaces 
&symbol(.N)& Display upto N decimal places 
&symbol(T)& Omit thousands separator 
&symbol(R)& Right justified 
&symbol(I)& Suppress output of the initial value

bgm 發表在 痞客邦 留言(0) 人氣()

SAP GUI常用快捷鍵

轉至 http://blogold.chinaunix.net/u1/40527/showart_2221844.html


F1:幫助
F2:雙擊。比如TC行的雙擊,LIST行的雙擊等
F3:後退(Back),後退按鈕
Shift+F3:退出(Exit),退出按鈕
F4:搜索幫助
F8:執行
F10:菜單
F12:取消(Cancel)
 
F5:創建
F6:修改
F7:顯示 <--以上三個在SE38、SE24、SE11等ABAP工作台用到的比較多
 
Ctrl+F1:修改<->查看
Ctrl+F3:激活
Ctrl+F:查找
Ctrl+P:打印
Ctrl+Y:選擇TC、ALV等的多行數據
Ctrl+,:註釋程序塊
Ctrl+.:取消註釋
Ctrl+;:創建SAP登錄快捷方式
Ctrl+/:設置輸入點到CommandField
 
Shift+F5:其他對象(Other object)

bgm 發表在 痞客邦 留言(0) 人氣()

UltraEdit

使用reg取代

例如想把
http://www.wowbox.tw/item.php?witem=12345
取代為
http://www.bbb.com/x.o?i=12345

可以用
http://www.wowbox.tw/item.php?witem=^(*^)*"
作搜尋目標
再用
http://www.bbb.com/x.o?i=^1
作為取代的值

語法說明
^(*^) 是用來紀錄該搜尋資料的
可以在取代值以 ^1 ^2 ~ ^9作取代標記

bgm 發表在 痞客邦 留言(16) 人氣()

MSN Messenger通訊埠功能 
連線功能 通訊協定 通訊埠號碼 
一般連線 TCP 1863 
語音通訊 UDP 6901 
檔案傳送 TCP 6891?6900 
遠端協助 TCP 3389 
應用程式/白板分享 TCP 7800?7825 
即時影音通訊 TCP 5100 
MSN Messenger 
訊息傳遞 TCP port 1863 
檔案傳輸 TCP port 6891 – 6900 
語音傳輸 TCP、UDP port 6901 
MSN port 
訊息:1863 
傳檔:6891-6900 
語音:6901 
ICQ通訊埠功能 
連線功能 通訊協定 通訊埠號碼 
登入ICQ伺服器 UDP 4000 或 
登入ICQ伺服器 TCP 5190 
一般連線 TCP 1024?65535 
ICQ 
UDP port 4000 - outbound 
TCP port 20000 – 20019, inbound for first user 
TCP port 20000 – 20039, inbound for second user 
Incremental for other users 
其他通訊埠功能 
連線功能 通訊協定 通訊埠號碼 
傳送E-MAIL TCP 25 
接收E-MAIL TCP 110 
傳送聊天室/ TCP HTTP:80/81?83 HTTP:443 
網路呼叫器等資料 SOCKS:1080/3128/8080/8088/11523 
HTTP TCP 80 
FTP TCP 20&21 
TELNET TCP 23 
YAHOO UDP 5050 
PCANYWHERE TCP 5631&5632

MSN 電玩特區(Game Zone) 
TCP port 6667 for Inbound session 
TCP prot 28800 - 29000 
Microsoft Age of Empires I、II (世紀帝國) 
DirectX 7 
Initical TCP connection 47624 
TCP 、UDP port 2300 – 2400 
Subsequent inbound and outbound connection 
DirectX 8 
Initical TCP connection 6073 
TCP 、UDP port 2300 – 2400 
Subsequent inbound and outbound connection 
Quake III 
UDP port 27660 for inbound session 
Each computer must use different port, starting at 27660 
EzPeer 
TCP port 28865 for inbound session 
Napster 
TCP、UDP port 6699 for inbound and outbound session

魔獸世界   >>> 3724
天堂II     >>> 7777
亂Online   >>> 5105 5502
楓之谷     >>> 8585 8686 8787
新天上碑   >>> 2000
熱血江湖   >>> 14000 15000
仙境傳說   >>> 5000
希望Online >>> 1818
魔力寶貝   >>> 9013
墨香Online >>> 14600~14602
黃易Online >>> 6877
飛飛Online >>> 15400

TS 8767

卡丁車  TCP 80、TCP 39311 、UDP 39311、TCP 36456、TCP 36567

Warcraft3 6112

bgm 發表在 痞客邦 留言(0) 人氣()

從網路上找來的

經常需要在數據庫與Execl之間互導數據。net時代,ADO.NET可以使用使用Microsoft.Jet.OleDb訪問訪問Excel,網上已經有很多類似的資源,最典型也是最簡單的可能如下:(asp.net環境)
// 連接字符串           
        string xlsPath = Server.MapPath("~/app_data/somefile.xls"); // 絕對物理路徑
        string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                        "Extended Properties=Excel 8.0;" +
                        "data source=" + xlsPath;
        // 查詢語句
        string sql = "SELECT * FROM [Sheet1$]";
        DataSet ds = new DataSet();
        OleDbDataAdapter da = new OleDbDataAdapter(sql, connStr);
        da.Fill(ds);    // 填充DataSet       
        // 在這裡對DataSet中的數據進行操作       

        // 輸出,綁定數據
        GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();
很簡單吧?!一切就像操作數據庫一樣,只是需要注意的是:
1。數據提供程序使用Jet,同時需要指定Extended Properties 關鍵字設置 Excel 特定的屬性,不同版本的Excel對應不同的屬性值:用於 Extended Properties 值的有效 Excel 版本。
對於 Microsoft Excel 8.0 (97)、9.0 (2000) 和 10.0 (2002) 工作簿,請使用 Excel 8.0。

對於 Microsoft Excel 5.0 和 7.0 (95) 工作簿,請使用 Excel 5.0。

對於 Microsoft Excel 4.0 工作簿,請使用 Excel 4.0。

對於 Microsoft Excel 3.0 工作簿,請使用 Excel 3.0。

ref:http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/dv_vbcode/html/vbtskcodeexamplereadingexceldataintodataset.asp

2。數據源路徑使用物理絕對路徑(同Access)

3。如何引用表名?
對 Excel 工作簿中表(或範圍)的有效引用。
若要引用完全使用的工作表的範圍,請指定後面跟有美元符號的工作表名稱。例如:

select * from [Sheet1$]
若要引用工作表上的特定地址範圍,請指定後面跟有美元符號和該範圍的工作表名稱。例如:

select * from [Sheet1$A1:B10]
若要引用指定的範圍,請使用該範圍的名稱。例如:

select * from [MyNamedRange]
ref:http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/dv_vbcode/html/vbtskcodeexamplereadingexceldataintodataset.asp
說明:
可以引用Excel 工作簿中的三種對像:
‧ 整張工作表:[Sheet1$]  ,Sheet1 就是工作表的名稱
‧ 工作表上的命名單元格區域:[MyNamedRange] (不需要指定工作表,因為整個xls中命名區域只能唯一)
XLS命名方法:選中單元格範圍》插入》名稱》定義
‧ 工作表上的未命名單元格區域 :[Sheet1$A1:B10]
(在關係數據庫提供的各種對像中(表、視圖、存儲過程等),Excel 數據源僅提供相當於表的對象,它由指定工作簿中的工作表和定義的命名區域組成。命名區域被視為「表」,而工作表被視為「系統表」)

注意:
‧必須使用[](方括號),否將報:
FROM 子句語法錯誤
‧必須跟$(美元符號),否則報:
Microsoft JetJets-of-the-Future Sep-07  數據庫引擎找不到對像'Sheet2'。請確定對象是否存在,並正確地寫出它的名稱和路徑。
‧如果工作表名稱不對,或者不存在,將報:
'Sheet2$' 不是一個有效名稱。請確認它不包含無效的字符或標點,且名稱不太長。
‧在 如何在 Visual Basic 或 VBA 中使用 ADO 來處理 Excel 數據   中提到可以使用
~  和 '(波浪線和單引號)代替[],使用ADO。NET測試沒有成功,報:
FROM 子句語法錯誤
‧當引用工作表明名([Sheet1$])時,數據提供程序認為數據表從指定工作表上最左上方的非空單元格開始。比如,工作表從第 3 行,C 列開始,第3行,C列之前以及第1、2行全為空,則只會顯示從第3行,C列開始的數據;以最後表最大範圍內的非空單元結束;
‧因此,如需要精確讀取範圍,應該使用命名區域 [NamedRange],或者指定地址:[Sheet1$A1:C10]

4。如何引用列名?
‧根據默認連接字符串中,數據提供程序會將有效區域內的第一行作為列名,如果此行某單元格為空則用F1、F2表示,其中序數,跟單元格的位置一致,從1開始;
‧如果希望第一行作為數據顯示,而非列名,可以在連接串的 Extended Properties 屬性指定:HDR=NO
默認值為:HDR=NO 格式如下:

        string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                        "Extended Properties=\"Excel 8.0;HDR=NO\";" +
                        "data source=" + xlsPath;
注意: Excel 8.0;HDR=NO  需要使用雙引號(這裡的反斜扛,是C#中的轉義)

ref:ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.chs/WD_ADONET/html/745c5f95-2f02-4674-b378-6d51a7ec2490.htm 中 《連接Excel》節(說明:在我自己的MSDN中,它的例子使用了兩個雙引號是錯的,測試沒有通過,原文這樣說的:

注意,Extended Properties 所需的雙引號必須還要加雙引號。

在這種情況下,所有的列名都是以F開頭,然後跟索引,從F1開始,F2,F3。。。。。。。

5。為什麼有效單元格數據不顯示出來?
出現這種情況的可能原因是,默認連接中,數據提供程序根據前面單元格推斷後續單元個的數據類型。
可以通過 Extended Properties 中指定 IMEX=1

「IMEX=1;」通知驅動程序始終將「互混」數據列作為文本讀取
ref:同4

PS:在baidu這個問題的時候,有網友說,將每個單元都加上引號,這固然是格方案,但是工作量何其大啊,又不零活,慶幸自己找到」治本藥方「
more ref:
如何在 Visual Basic 或 VBA 中使用 ADO 來處理 Excel 數據
http://dotnet.aspx.cc/ShowDetail.aspx?id=C673E2CD-3F1E-4919-8CE0-D69B894A0599

應用程序經常需要與Excel進行數據交互,以上闡述了基於ADO.NET 讀取Excel的基本方法與技巧。現在要介紹是如何動態的讀取Excel數據,這裡的動態指的是事先不知道Excel文件的是什麼樣的結構,或者無法預測,比如一張.xls文件有多少張sheet,而且每張sheet的結構可能都不一樣等等。
其實我們可以通過獲取Excel的「架構信息」來動態的構造查詢語句。這裡的「架構信息」與數據庫領域的「數據庫架構信息」意義相同(也稱「元數據」),對於整個數據庫,這些「元數據」通常包括數據庫或可通過數據庫中的數據源、表和視圖得到的目錄以及所存在的約束等;而對於數據庫中的表,架構信息包括主鍵、列和自動編號字段等。
在上文中提到

在關係數據庫提供的各種對像中(表、視圖、存儲過程等),Excel 數據源僅提供相當於表的對象,它由指定工作簿中的工作表和定義的命名區域組成。命名區域被視為「表」,而工作表被視為「系統表」)

這裡我們將Excel也當作一個「數據庫」來對待,然後利用OleDbConnection.GetOleDbSchemaTable 方法
要獲取所需的架構信息,該方法獲取的架構信息與ANSI SQl-92是兼容的:

注意:對於那些不熟悉 OLE DB 架構行集的人而言,它們基本上是由 ANSI SQL-92 定義的數據庫構造的標準化架構。每個架構行集具有為指定構造提供定義元數據的一組列(稱作 .NET 文檔中的「限制列」)。這樣,如果請求架構信息(例如,列的架構信息或排序規則的架構信息),則您會明確知道可以得到哪種類型的數據。如果希望瞭解更多信息,請訪問 Appendix B:Schema Rowsets。
ref:http://www.microsoft.com/china/msdn/library/office/office/odatanet2.mspx?mfr=true

以下是讀取Excel文件內「表」定義元數據,並顯示出來的的程序片斷:

        // 讀取Excel數據,填充DataSet
        // 連接字符串           
        string xlsPath = Server.MapPath("~/app_data/somefile.xls");
        string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                        "Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\";" + // 指定擴展屬性為 Microsoft Excel 8.0 (97) 9.0 (2000) 10.0 (2002),並且第一行作為數據返回,且以文本方式讀取
                        "data source=" + xlsPath;
        string sql_F = "SELECT * FROM [{0}]";

        OleDbConnection conn = null;
        OleDbDataAdapter da = null;
        DataTable tblSchema = null;
        IList<string> tblNames = null;

        // 初始化連接,並打開
        conn = new OleDbConnection(connStr);
        conn.Open();

        // 獲取數據源的表定義元數據                       
        //tblSchema = conn.GetSchema("Tables");
        tblSchema = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });

        GridView1.DataSource = tblSchema;
        GridView1.DataBind();

        // 關閉連接
        conn.Close();
GetOleDbSchemaTable 方法的詳細說明可以參考:
http://msdn2.microsoft.com/zh-CN/library/system.data.oledb.oledbconnection.getoledbschematable.aspx

接著是一段利用「架構信息」動態讀取Excel內部定義的表單或者命名區域的程序片斷:

        // 讀取Excel數據,填充DataSet
        // 連接字符串           
        string xlsPath = Server.MapPath("~/app_data/somefile.xls");
        string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +
                        "Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\";" + // 指定擴展屬性為 Microsoft Excel 8.0 (97) 9.0 (2000) 10.0 (2002),並且第一行作為數據返回,且以文本方式讀取
                        "data source=" + xlsPath;
        string sql_F = "SELECT * FROM [{0}]";

        OleDbConnection conn = null;
        OleDbDataAdapter da = null;
        DataTable tblSchema = null;
        IList<string> tblNames = null;

        // 初始化連接,並打開
        conn = new OleDbConnection(connStr);
        conn.Open();

        // 獲取數據源的表定義元數據                       
        //tblSchema = conn.GetSchema("Tables");
        tblSchema = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });

        //GridView1.DataSource = tblSchema;
        //GridView1.DataBind();

        // 關閉連接
        //conn.Close();

        tblNames = new List<string>();
        foreach (DataRow row in tblSchema.Rows) {
            tblNames.Add((string)row["TABLE_NAME"]); // 讀取表名
        }

        // 初始化適配器
        da = new OleDbDataAdapter();
        // 準備數據,導入DataSet
        DataSet ds = new DataSet();

        foreach (string tblName in tblNames) {
            da.SelectCommand = new OleDbCommand(String.Format(sql_F, tblName), conn);
            try {
                da.Fill(ds, tblName);
            }
            catch {
                // 關閉連接
                if (conn.State == ConnectionState.Open) {
                    conn.Close();
                }
                throw;
            }
        }

        // 關閉連接
        if (conn.State == ConnectionState.Open) {
            conn.Close();
        }

        // 對導入DataSet的每張sheet進行處理       
        // 這裡僅做顯示
        GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();

        GridView2.DataSource = ds.Tables[1];
        GridView2.DataBind();

        // more codes
        // .

這裡我們就不需要對SELECT 語句進行「硬編碼」,可以根據需要動態的構造FROM 字句的「表名」。

不僅可以,獲取表明,還可以獲取每張表內的字段名、字段類型等信息:

tblSchema = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new object[] { null, null, null, null });

在ADO.nET 1.x 時候只有OleDb提供了GetOleDbSchemaTable 方法,而SqlClient或者OrcaleClient沒有對應的方法,因為對應數據庫已經提供了類似功能的存儲過程或者系統表供應用程序訪問,比如對於Sql Server:

SELECT *
FROM Northwind.INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = N'Customers'

而在ADO.NET 2.0中每個xxxConnenction都實現了基類System.Data.Common.DbConnection的 GetSchemal 方法
來獲取數據源的架構信息。
http://msdn2.microsoft.com/zh-cn/library/system.data.common.dbconnection.getschema.aspx

bgm 發表在 痞客邦 留言(0) 人氣()

因為專案需要,開發網頁輸入程式

其中有檢查同個名稱為slColumn的select 

用document.main.slColumn.length檢查
在多個slColumn下,上述方法會檢查出正確的名稱為slColumn數量

但是只有一個slColumn,document.main.slColumn.length 會等於document.main.slColumn.options.length

所以不能用slColumn.length來檢查slColumn數量

請改用DOM取得名稱為slColumn的物件

var oslColumn= document.getElementsByName("slColumn");

再用 oslColumn.length 取得slColumn數量
而 oslColumn[i] 則可取得第i個slColumn物件

接下來 oslColumn[i].length 就會是 options的數量了

bgm 發表在 痞客邦 留言(0) 人氣()

藍色小舖

http://www.blueshop.com.tw/board/show.asp?subcde=BRD20020307142601RJ7&fumcde=FUM200410061525290EW&rplcnt=15


下面說明,因為include 為SEVER SIDE SSI語法,所以前後的if、select判斷式都不會執行

http://www.learnasp.com/freebook/asp/inc.aspx

Include Files

The include option is the heart of making efficient ASP files and re-usable chunks. It basically 
has two forms and now we will present the forms and their differences:

<!--#include virtual="/whatever.asp"-->
would include any file on your site (in this example, whatever.asp is in the web server's root directory) 
but you must fully qualify the filename with a path.

<!--#include file="whatever.asp"-->
can include the whatever.asp file in  the directory of the script that contains the statement. 
It ASSUMES the current directory!

Example #1
<!--#include virtual="/sally/filename.asp"-->
could include a file from sally's directory, even if the page with this statement is (for example) 
in the /fred/finance folder.

Example #2:
<!--#include file="/sally/filename.asp"-->
will fail from fred's directory.

Example #3:
<!--#include file="../sally/filename.asp"-->
will succed from fred's directory but if the script that contains it is moved to a different level in the tree structure 
it will fail to locate the file. INCLUDE VIRTUAL is better if a script may be moved and is immune to relative path issues.

IMPORTANT: Include files are always processed and inserted before ASP scripts on the page are calculated. Thus a page with many IFs and SELECT CASEs that selectively include files in fact always include the file before the script begins executing.


請參考下面的動態載入方式

Includes Files Dynamically

The include files are gathered and processed BEFORE any ASP code. Soif your code looks like this:

<%SELECT CASE
     CASE 1 %>
    <!--#include virtual="whatever1.asp"-->
     CASE 2 %>

    <!--#include virtual="whatever2.asp"-->
     CASE 3 %>
    <!--#include virtual="whatever3.asp"-->
<%END SELECT%>

Three includes are performed before any ASP code is executed.

YOU CANNOT DO:

<%
     whichfile="1"%>
  <!--#include virtual="whatever<%=whichfil%>.asp"-->

Though this is a reasonable idea.

<!--#include virtual="whatever.asp"-->

We however have coded a workaround that is FREE you may find useful. The workaround is:

   filename=/learn/test/includedynamic.asp

<Test Script Below>

<html><head>


<TITLE>includedynamic.asp</TITLE>


</head><body bgcolor="#FFFFFF">


<%


whichfile="bookscifi.asp"


Call ReadDisplayFile(whichfile)


response.write "<hr>"





whichfile="bookhorror.asp"


Call ReadDisplayFile(whichfile)


response.write "<hr>"








whichfile="/learn/test/bookmarketing.asp"


Call ReadDisplayFile(whichfile)


response.write "<hr>"


%>





</body></html>


<%


SUB ReadDisplayFile(FileToRead)


whichfile=server.mappath(FileToRead)


Set fs = CreateObject("Scripting.FileSystemObject")


Set thisfile = fs.OpenTextFile(whichfile, 1, False)


tempSTR=thisfile.readall


response.write tempSTR


thisfile.Close


set thisfile=nothing


set fs=nothing


END SUB


%>


 

 

The only downside to this method is no ASP Code ( i.e. anything in <% %> ) will be parsed or executed in the included file. If you must execute ASP code the Win2k server.execute @
/freebook/asp/incwin2k.aspx
or the 3rd party components like ASPHTTP must be employed @
/learn/include/asphttp.asp



Includes - Other Sites/Dynamic FileNames

3rd party components like ASPHTTP can grab the HTML contents of a specific URL into an ASP string. Supports GET/POST/HEAD documents via the HTTP protocol, examining response headers, transfering requests to a file (including binary transfers) and password authentication support. They can also be used on YOUR OWN SITE to make dynamic includes possible.

available at http://www.serverobjects.com/products.htm

Microsoft includes WinInet which seems to be ideally suited for this EXCEPT is currently not thread safe, see:
http://www.learnasp.com/advice/threadsafe.asp
so Tools like ASPHTTP are a necessity.

Here is a sample where ASPHTTP is used to grab contents from another site.

   filename=/learn/test/asphttpother.asp

<Test Script Below>

<html><head>


<title>asphttpother.asp</title>


</head>


<body>


<%


Set HttpObj = Server.CreateObject("AspHTTP.Conn")





HttpObj.Url = "http://www.funinspace.com"


strResult = HttpObj.GetURL





STRresult=server.htmlencode(STRresult)


response.write STRresult





SET HTTPobj = nothing


%>


</body>


</html>








 

 

Here is a sample where ASPHTTP is used to allow a string to decide  which page on our site is executed.

   filename=/learn/test/asphttpdynamic.asp

<Test Script Below>

<html><head>


<title>asphttpdynamic.asp</title>


</head>


<body bgcolor="#FFFFFF">


<%


mystring="/learn/test/response.asp"





Set HttpObj = Server.CreateObject("AspHTTP.Conn")


HttpObj.Url = "http://www.learnasp.com" & mystring


strResult = HttpObj.GetURL


response.write STRresult





SET HTTPobj = nothing


%>


</body>


</html>



或是下面網址的方式









http://www.asp101.com/articles/michael/dynamicincludes/default.asp

Dynamic Include Files

by Michael Qualls 

Introduction


This is an advanced example and it assumes that you are already familiar with HTML, ASP,
and using ActiveX Objects. In it I use the FileSystemObject and TextStream Objects to create
"dynamic" includes.

Dynamic Include Files


I think that at one time or another all of us have attempted to create dynamic include files
in our ASP applications only to find out that it would not work. The usual approach was to
use a variable to hold the name of the file that you wanted to include and then pass the
name of that variable to the include directive.
Let us be clear: The following code will not work:
<%


'A variable is declared to hold a file name


Dim MyFile





'The desired file name is passed to the variable.


MyFile = Request("SomeFileName")





'Then the variable holding the file name is passed


'to the include directive.


%>


<!--#include file=<%=MyFile%>-->


The reason that this code listing will not work is because in Active Server Pages the include
directives are resolved before the server-side script portions are processed.
The above code listing will trigger a nasty error telling you that the include file cannot be found.

One of the reasons to use an include file is to be a container for static HTML
that does not normally change (such as a standard header or footer).
This file is then referenced using a normal include directive. However, sometimes,
different content is needed based upon user input or some other condition.
Rather than create an entirely different web page for each and every possible condition,
the idea of using "dynamic include" files was born. However, as noted in the code listing above,
the most logical way to implement this idea does not work.

In order to get around this problem, the Microsoft FileSystemObject Object can be used to load
and pass the content of the desired include file into a string variable which can be inserted into
the page that is being sent to the client. The following function, "getFileContents",
aids in this process by loading a file that is passed to the function as an input parameter and
returning its contents as a string.

<%





'Pass the name of the file to the function.


Function getFileContents(strIncludeFile)


Dim objFSO


Dim objText


Dim strPage








'Instantiate the FileSystemObject Object.


Set objFSO = Server.CreateObject("Scripting.FileSystemObject")








'Open the file and pass it to a TextStream Object (objText). The


'"MapPath" function of the Server Object is used to get the


'physical path for the file.


Set objText = objFSO.OpenTextFile(Server.MapPath(strIncludeFile))








'Read and return the contents of the file as a string.


getFileContents = objText.ReadAll





objText.Close


Set objText = Nothing


Set objFSO = Nothing


End Function


%>


Using this function "dynamic include" files can be achieved. First, the main page
(a template file containing the page layout and any static content) would be loaded and passed
to a string variable. Then, the contents of the include file would be loaded and passed to a string variable.
Finally, the variable containing the contents of the include file would be inserted into
the contents of the variable containing the main page.

Example: Dynamic Include Files

First, lets take a look at the "template" file. In this listing, there is an HTML comment,
"<!-- INCLUDE FILE HERE -->". We will replace this HTML comment with the content of the include file.

<html>


<body>


<h2>Welcome to my web page!</h2>


<table width="500" border="1">


<tr>


<td>


<!-- INCLUDE FILE HERE -->


</td>


</tr>


</table>


</body>


</html>


Now, lets look at the include files that will be used for this example. The first include file is the
default include file. The default include file is a form that allows the client to choose which of three
include files to load. Notice that the "action" attribute of the form is omitted. This is because when
the form will be submitting to itself (causing "dynamicinc3.asp" to reload).

<!-- BEGIN DEFAULT INCLUDE -->


<form method="post">


<h3>Select the name of the file you wish to load</h3>


<p>


<select id=cboFile name=cboFile>


<option value="includefile1.inc">File #1</option>


<option value="includefile2.inc">File #2</option>


<option value="includefile3.inc">File #3</option>


</select>


<input type="submit" value="Submit">


</p>


</form>


<!-- END DEFAULT INCLUDE -->


For the sake of this example, the content of the other three include files has been kept very simple.

<!-- BEGIN INCLUDE FILE #1 -->


<h2 style="color:red">FILE #1 CONTENTS</h2>


<br>


<a href="dynamicinc3.asp">Return to default page</a>


<!-- END INCLUDE FILE #1 -->


<!-- BEGIN INCLUDE FILE #2 -->


<h2 style="color:green">FILE #2 CONTENTS</h2>


<br>


<a href="dynamicinc3.asp">Return to default page</a>


<!-- END INCLUDE FILE #2 -->


<!-- BEGIN INCLUDE FILE #3 -->


<h2 style="color:blue">FILE #3 CONTENTS</h2>


<br>


<a href="dynamicinc3.asp">Return to default page</a>


<!-- END INCLUDE FILE #3 -->


Finally, consider the ASP file that makes the whole example run, "dynamicinc3.asp".

<%





'-------------------------------------------------------------


'The "getFileContents" function should be included at the top


'of the ASP file.


'-------------------------------------------------------------





'Declare variables to hold the content of the main page and


'the include file.


Dim strMain, strInclude





'Get the contents of the main page and pass them to the "strMain"


'variable.


strMain = getFileContents("maintemplate.inc")





'Test to see if the "cboFile" select box is being submitted. If so,


'load the requested include file. If not, load the default include.


If Request.form("cboFile") = "" Then


strInclude = getFileContents("includedefault.inc")


Else


strInclude = getFileContents(Request.form("cboFile"))


End If





'After the proper include file contents are loaded ("strInclude"),


'then insert it into the main page ("strMain") using the "Replace"


'function.


strMain = replace(strMain,"<!-- INCLUDE FILE HERE -->",strInclude)





'Use the "Response" Object to "Write" the completed page to the client.


Response.Write strMain





%>


This sample works, and, in effect, creates the ability to use dynamic include files because it does
not use the include directive. Instead this example uses the FileSystemObject Object.

This technique can be useful if you wish to keep your layout separated from your content.
You can create a template which contains the layout for your website and include files which
contain the content of the website. Then using ASP, you can combine the two for client viewing.
This is exactly the way that I put my website together!

Let me give you one last thing to think about. How would using techniques similar to this aid you
if you are storing your data in XML files?

Related Links


bgm 發表在 痞客邦 留言(0) 人氣()

轉自: http://blog.blueshop.com.tw/HammerChou/archive/2006/06/18/29105.aspx

如何使用
CDO 物件來寄 E-Mail

 

CDO ( Collaboration Data Objects ) 物件 對應檔案 CDOSYS.dll E-Mail 寄送使用;

可應用於 VB ASP .Net 是簡單的信件寄送方式之一

 

    Dim objCDO As Object

    Dim strCfg As String

 

    Set objCDO = CreateObject("CDO.Message")

    strCfg = "http://schemas.microsoft.com/cdo/configuration/"

 

    With objCDO

       

        .Sender = "別胡亂送@OhMyGod.com"

        .From = "誰是寄件者@NoOneKnows.com"

        .To = "要寄給誰@whois.com.tw"

 

        .Fields("urn:schemas:mailheader:X-Priority") = 1 ' Priority = PriorityUrgent 高優先順序

        .Fields("urn:schemas:mailheader:return-receipt-to") = "誰是寄件者@NoOneKnows.com" ' 要求讀取回條

         ' .Fields("urn:schemas:httpmail:importance") = 2 ' Importance = High

       ' .Fields("urn:schemas:httpmail:priority") = 1 ' Priority = PriorityUrgent

        .Fields.Update ' 更新欄位

       

        .Subject = "沒有主旨(放主題啦)"

       

        .TextBody = "ORZ" ' Text 文字格式信件內容

        ' HTML 網頁格式信件內容

        .HTMLBody = "<HTML>" & _

                                "<BODY>" & _

                                "<table border=""1"" width=""100%"">" & _

                                "<tr><td>I</td><td>am</td><td>Hammer</td><td>!</td></tr>" & _

                                "<tr><td>Who</td><td>r</td><td>u</td><td>?</td></tr>" & _

                                "</table>" & _

                                "</BODY>" & _

                                "</HTML>"

                               

        .AddAttachment "C:\AttFile.zip" ' 附加檔案

       

        .CC = "Xman@yahoo.com.tw"   ' 副本

        .BCC = "SpiderMan@hotmail.com.tw" ' 密件副本

       

        .Configuration(strCfg & "sendusing") = 2 ' Sendusing = SendUsingPort

        .Configuration(strCfg & "smtpserver") = "msa.hinet.net" ' SMTP Server

       ' .Configuration(strCfg & "smtpserverport") = 25 ' SMTP Server Port ( 預設即為 25 )

 

        ' SMTP Server 如需登錄 , 則需設定 UserName / Password

        ' .Configuration(strCfg & "sendusername") = "UserName" ' Send User Name

        ' .Configuration(strCfg & "sendpassword") = "Password" ' Send Password

       

        .Configuration.Fields.Update ' 更新 (欄位) 組態

       

       ' .DSNOptions = 4 ' 回傳信件傳送狀態

       '  cdoDSNDefault = 0 , DSN commands are issued.

       '  cdoDSNDelay = 8 , Return a DSN if delivery is delayed.

       '  cdoDSNFailure = 2 , Return a DSN if delivery fails.

       '  cdoDSNNever = 1 , No DSNs are issued.

       '  cdoDSNSuccess = 4 , Return a DSN if delivery succeeds.

       '  cdoDSNSuccessFailOrDelay = 14 ,Return a DSN if delivery succeeds, fails, or is delayed.

 

        .Send ' 傳送

       

    End With

   

    Set objCDO = Nothing

bgm 發表在 痞客邦 留言(0) 人氣()

SWIFT CODE

Society Worldwide Interbank Financial Telecommunication環球同業銀行金融電訊協會

http://www.swift.com

常見為11碼(不確定)

各分行會有其代碼,同一家銀行前幾碼會相同

用來作國際電匯交易用

bgm 發表在 痞客邦 留言(0) 人氣()

create table #T(姓名 varchar(100), 科目 varchar(100), 成績 int)

insert into #T select '林', '軟件測試', 90
insert into #T select '林', '分佈式數據庫', 70
insert into #T select '王', '分佈式數據庫', 80

CREATE PROCEDURE Test2
AS

Declare @sql varchar(8000)
Select @sql = ''

--動態生成case when 語句
Select @sql = @sql + ', SUM(Case 科目 When ''' + 科目 + ''' Then 成績 Else 0 End) As ' + 科目
From #T Group By 科目

--按姓名分組
Select @sql = ' Select 姓名,' + Stuff(@sql, 1, 1, '') + ',sum(成績) as 總分 From #T Group By 姓名'


--打印出動態生成的SQL語句
print @sql

EXEC(@sql)

go


輸出的結果

姓名 分佈式數據庫 軟件測試 總分
80 0 80
70 90 160

bgm 發表在 痞客邦 留言(0) 人氣()

備份ODBC

odbc資訊存在registry下的

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources


System DSN's are stored in the registry at the following key:

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources

The simple method is to load REGEDIT.EXE and browse to that key and select
File-Export

You can automate this using regedit.exe via the following

regedit.exe /e "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources"

Note: The command line above should be on 1 line.

You could also script this using VBScript if you like to automate this
process and have more control.

bgm 發表在 痞客邦 留言(0) 人氣()

1 234