2011年3月14日 星期一

將資料匯出到Excel(*.csv),文字格式資料的處理手法

目前查到的有幾種解法:
1.設定儲存格格式
<td style="mso-number-format:\@">
資料參考來源:http://yanyoliu.blogspot.com/2006/04/asp-excel.html

2.數字前面加上單引號
參考資料:http://www.programmer-club.com.tw/ShowSameTitleN/asp/12676.html

3.數字前面加上chr(127)
參考資料:http://www.blueshop.com.tw/board/show.asp?subcde=BRD200606191649367F8
ASCII字碼對應表
http://www.roubaixinteractive.com/PlayGround/Binary_Conversion/The_Characters.asp

2011年3月9日 星期三

Recordset 語法及相關運作

資料來源:http://blog.blueshop.com.tw/mars/archive/2004/09/08/177.aspx


語法
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.Open Source, ActiveConnection, CursorType, LockType, Options

參數
Source 選擇性參數:  此 Variant 是為一個有效的 Command 物件變數名稱、SQL 陳述式、資料表名稱、已存的程序呼叫,或是一個保存的 Recordset 的檔名。
ActiveConnection 選擇性參數:  不是 Variant 得到一個有效的 Connection 物件變數名稱,就是 String 包含 ConnectionString 參數。
CursorType 選擇性參數:  此 CursorTypeEnum 值決定提供者在開啟 Recordset 時應使用的指標類型。其可以是下列其中一種常數。

常數說明
adOpenForwardOnly:開啟一個順向資料指標。(預設)
AdOpenKeyset:開啟一個索引鍵集 (keyset-type) 資料指標。
AdOpenDynamic:開啟一個動態資料指標。
AdOpenStatic:開啟一個靜態資料指標。
LockType 選擇性參數:
此 LockTypeEnum 值決定提供者在開啟 Recordset 時應使用何種鎖定 (同時性)。其可以是下列其中一種常數。
常數說明adLockReadOnly:唯讀,資料無法變更。(預設)
AdLockPessimistic:悲觀鎖定,提供者會進行必要的動作以確保能順利編輯資料錄,其方法通常是在編輯時立即在資料源處鎖定資料錄。
AdLockOptimistic:樂觀鎖定,提供者使用樂觀性鎖定,當您呼叫 Update 方法時,僅鎖定資料錄。
AdLockBatchOptimistic:樂觀批次更新,此為批次更新模式所需,與即時更新模式相反。
Options 選擇性參數:  
一個 Long 值,表示提供者在 Source 引數代表 Command 物件以外的東西時應如何評估它,否則 Recordset 應從前次儲存的檔案還原。它可以是下列其中一種常數。

常數說明
adCmdText:提供者會將 Source 評估為指令的文字定義。
AdCmdTable:ADO 會產生一個 SQL 查詢,從 Source 中指定的資料表傳回所有資料列。
AdCmdTableDirect:提供者會從 Source 中指定的資料表傳回所有資料列。
AdCmdStoredProc:提供者會將 Source 評估為一個預存程序。
AdCmdUnknown:Source 引數中未知的指令類型。
AdCommandFile:保留的 (已儲存的) Recordset 會從 Source 中指定的檔案還原。
AdExecuteAsync:Source 作非同步執行。
AdFetchAsync:表示在 CacheSize 屬性中指定的初始數量被抓取後,剩下的資料列就會被非同步地抓取。
應用函數
RecordSet.BOF 判斷指標是否超過最前面
RecordSet.EOF 判斷指標是否超過最後面
RecordSet.MoveFirst 將資料錄指標移至第一筆
RecordSet.MoveLast 將資料錄指標移至最後一筆
RecordSet.MoveNext 將資料指標往後移一筆
RecordSet.MovePrevious 將資料指標往前移一筆
RecordSet.Fields.Count 傳回Recordset中的欄位數
RecordSet(i).Name 傳回Recordset中第i個欄位的名稱
RecordSet.RcordCount 傳回Recordset中資料錄的筆數
RecordSet("欄位名稱") 傳回指定欄位名稱的資料內容
RecordSet(i) 傳回RecordSet中的第i個欄位資料
RecordSet.Fields(i).DefinedSize 傳回RecordSet中的第i個欄位資料欄位長度
RecordSet.Fields(i).Type 傳回RecordSet中的第i個欄位資料欄位資料型別
RecordSet.BookMark 傳回設定的書籤以儲存現在紀錄的位置。RecordSet.AbsolutePostition 將指標移至RecordSet中的某一筆資料上
RecordSet.PageSize 設定每頁顯示的資料筆數
RecordSet.PageCount 傳回分頁後的總頁數
RecordSet.AbsolutePage 傳回目前所在的頁數
RecordSet.AddNew 新增資料至資料表中
RecordSet.Update 更新目前這筆資料
RecordSet.Delete 刪除目前這筆資料
RecordSet.Find 尋找資料值
RecordSet.GetRows 可將Recordset中的資料儲存至陣列中
RecordSet.Sort 可將Recordset中的資料排序

2011年2月28日 星期一

Switching DIV Background Image With jQuery

範例如下:
$('#divID').css("background-image", "url(/myimage.jpg)"); 

$('#divID').click(function()
{
  // do my image switching logic here.
});

$('#divID').mouseover(function()
{
  // do my image switching logic here.
});

$('#divID').mouseout(function()
{
  // do my image switching logic here.
});
 

2011年2月25日 星期五

表格的colspan在firefox顯示不出來怎麼辦?

參考資料:http://thedesignspace.net/MT2archives/000376.html

<table border=1>
<tr style="display:block">
<th colspan="3">
Using display:block on this table. This th should span 3 columns
</th>
</tr>
<tr> 
<td>cell 1</td>
<td>cell 2</td>
<td>cell 3</td>
</tr>
</table>
<table border=1>
<tr style="display:table-row">
<th colspan="3">
Using display:table-row on this table. This th should span 3 columns
</th>
</tr>
<tr> 
<td>cell 1</td>
<td>cell 2 </td>
<td>cell 3</td>
</tr>
</table>
把display:block改用display:table-row,就ok啦!