星期四, 3月 27, 2008

[Database] ADO Data Types與數據庫值對應


嘿!有這個對應表的話,用程式來建立資料表就方便多了。


由於用 asp + oldeb for foxpro,所以要參考 Oledb 的部分。


ADO Data Types與數據庫值對應 http://www.zaoxue.com/article/tech-48473.htm








































































































































DataType EnumValueAccessSQLServer
adBigInt20
BigInt (SQL Server 2000 +)
adBinary128
Binary
TimeStamp
adBoolean11YesNoBit
adChar129
Char
adCurrency6CurrencyMoney
SmallMoney
adDate7DateDateTime
adDBTimeStamp135DateTime (Access 97 (ODBC))DateTime
SmallDateTime
adDecimal14

adDouble5DoubleFloat
adGUID72ReplicationID (Access 97 (OLEDB)), (Access 2000 (OLEDB))UniqueIdentifier (SQL Server 7.0 +)
adIDispatch9

adInteger3AutoNumber
Integer
Long
Identity (SQL Server 6.5)
Int
adLongVarBinary205OLEObjectImage
adLongVarChar201Memo (Access 97)
Hyperlink (Access 97)
Text
adLongVarWChar203Memo (Access 2000 (OLEDB))
Hyperlink (Access 2000 (OLEDB))
NText (SQL Server 7.0 +)
adNumeric131Decimal (Access 2000 (OLEDB))Decimal
Numeric
adSingle4SingleReal
adSmallInt2IntegerSmallInt
adUnsignedTinyInt17ByteTinyInt
adVarBinary204ReplicationID (Access 97)VarBinary
adVarChar200Text (Access 97)VarChar
adVarWChar202Text (Access 2000 (OLEDB))NVarChar (SQL Server 7.0 +)

[DATABASE] 各種資料庫的欄位型態


下列的參考資料十分不錯,列出大部分用到的資料庫欄位型態,寫程式時還蠻有用的!


Databases - Field Types http://mc-computing.com/Databases/FieldTypes.html


ex:




Foxpro














































































TypeSizeDescription
Character1 to 254
Currency8 bytes18 significant figures, including 4 decimal places
Not available in Database Explorer
Date8 bytesJanuary 1st, 1 A.D to December 31st, 9999 A.D
DateTime8 bytes
Logical1 byte
Variant
Can hold any type of field
Double8 bytes+/-4.94065645841247E-324 to +/-8.9884656743115E307
13 significant figures
This range does not make sense
Numeric1 to 20 bytes- .9999999999E+19 to .9999999999E+20
up to 10 significant figures (specified by the user), same as Float
Float1 to 20 bytes- .9999999999E+19 to .9999999999E+20
up to 10 significant figures (specified by the user), same as Numeric
Integer4 bytes-2,147,483,647 to 2,147,483,647
Integer (Autoinc)4 bytesAutoincrement field
General4 bytes in tableReference to an OLE object
The type is OLE in Database Explorer
Memo4 bytes in tableValues may be modified depending on the language mapping
Database Explorer indicates that these are actually 10 bytes each
Memo (Binary)4 bytes in tableValues are not modified When the code page changes

星期三, 3月 26, 2008

[ADO] Foxpro


建立資料表(TABLE)
EX: Create Table test( id char(10), bookname character(100), number int)


刪除資料表
EX: DROP TABLE test


新增記錄
EX1: INSERT INTO test VALUES ('111', 'Life is Sad', 100)
EX2: INSERT INTO test (id, bookname, number) VALUES ('111', 'Life is Sad', 100)



  • foxpro 8.0 以後可以用 autoinc 型態來設定自動編號

  • oledb for vfp 支援 autoinc 語法,
    ex: Create Table test( id int primary key autoinc, bookname character(100), number int)

  • oledb for vfp 不支援 " CREATE DATABASE" 的語法


星期四, 3月 20, 2008

轉貼 - REMBO 與 GHOST 之比較


Rembo 和 ghost 都是管理電腦教室的好幫手,兩者的管理方式其實有很大的差異,若是個人的話,比較偏愛用 Rembo 這種方式,不過,前提是網路和主機不能出問題啊!!


以下是台中縣吳仁智老師對兩者的比較:http://www.cses.tcc.edu.tw/~chihwu/rembo.htm


星期一, 3月 17, 2008

[HTML/CSS] 避免誤用不佳的 HTML標籤


開宗明義就講了,儘量用 CSS 來取代常用的HTML。
請詳讀 http://webdesign.about.com/od/css/a/aa101706.htm


How to Avoid Deprecated HTML


Use CSS Instead



When you're trying to write valid XHTML, you need to avoid the elements that have been deprecated. Using them will result in Web pages that may not work in a future version. This is because while the tag is still part of the XHTML specification, it may not be included in the future. And if it's not included, browsers won't support it.


Many deprecated XHTML elements were deprecated in favor of CSS style sheets. And it can be very easy to use CSS instead of many of these elements.


-------------------------------------------以下省略

星期五, 3月 14, 2008

[程式設計] 在文字方塊按下 Enter 後做動作


原本利用 Submit 按鈕時都沒有問題,不過,因為在表單送出前要先做檢查,所以把 submit 改成 button,這一來在文字方塊按 【Enter】就沒有作用了。


解決之道是利用 onKeyDown 這個事件來捕捉 【Enter】的 KeyCode,作法如下:
------------------------------------------------------------------------------------------
<script language=javascript>
function EnterToTab(){
if(event.keyCode==13)
event.keyCode=9;
}

</
script>
------------------------------------------------------------------------------------------
在文字方塊中加入 onkeydown="EnterToTab();" 的屬性,這樣一來就可以了。


不過,這時又會出現新的問題,在 firefox 無法捕捉到 Enter 的 KeyCode,原來兩者的捕捉 KeyCode 的屬性不一樣,完整解決方式如下:


------------------------------------------------------------------------------------------
function EnterToSubmit(e){

var keynum;
if(window.event) { // IE
keynum = e.keyCode;
}else if(e.which) { // Netscape/Firefox/Opera
keynum = e.which;
}
if(keynum == 13){
document.forms["formName"].submit();
}


}
------------------------------------------------------------------------------------------
onKeyDown="EnterToSubmit(event);"


FTP 主動式與被動式


雖然是英文,不過還是很值得花點時間好好看看!



Active FTP vs. Passive FTP, a Definitive Explanation