/* 取日期 */
select curdate();
select curdate() + 0 dateNow;
/* 取時間 */
SELECT CURTIME();
SELECT CURTIME() + 0;
/*系統日期加減*/
select Date_ADD((select curdate() + 0 dateNow), INTERVAL -2 MONTH);
取自http://mysql.yui.tw/2008/03/regexp-rlike.html的資料
2009年6月7日 星期日
2009年4月1日 星期三
避免帶入的參數導致SQL資料隱碼。
來自http://www.player.idv.tw/prog/index.php/SafeSQL.asp的文章
Function SafeSqlStr(Str)
SafeSqlStr=Str
SafeSqlStr=Replace(SafeSqlStr,"'","''")
SafeSqlStr="'"+SafeSqlStr+"'"
End Function
Function SafeSqlLike(Str)
SafeSqlLike=Str
SafeSqlLike=Replace(SafeSqlLike,"'","''")
SafeSqlLike="'%"+SafeSqlLike+"%'"
End Function
Function SafeSqlInt(Var)
If (IsNumeric(Var)) Then
SafeSqlInt=CInt(Var)
Else
SafeSqlInt=0
End If
End Function
Function SafeSqlDate(Var)
If (IsDate(Var)) Then
SafeSqlDate="'"+CStr(CDate(Var))+"'"
Else
SafeSqlDate="'"+CStr(Date())+"'"
End If
End Function
Function SafeHtmlStr(Str)
SafeHtmlStr=Str
SafeHtmlStr=Replace(SafeHtmlStr,"&","&")
SafeHtmlStr=Replace(SafeHtmlStr,"<","<")
SafeHtmlStr=Replace(SafeHtmlStr,">",">")
SafeHtmlStr=Replace(SafeHtmlStr," "," ")
SafeHtmlStr=Replace(SafeHtmlStr,chr(13),"
")
End Function
Function SafeJsStr(Str)
SafeJsStr=Str
SafeJsStr=Replace(SafeJsStr,chr(10),"")
SafeJsStr=Replace(SafeJsStr,chr(13),"\n")
SafeJsStr=Replace(SafeJsStr,"'","\'")
SafeJsStr=Replace(SafeJsStr,"""","\""")
End Function
Function SafeSqlStr(Str)
SafeSqlStr=Str
SafeSqlStr=Replace(SafeSqlStr,"'","''")
SafeSqlStr="'"+SafeSqlStr+"'"
End Function
Function SafeSqlLike(Str)
SafeSqlLike=Str
SafeSqlLike=Replace(SafeSqlLike,"'","''")
SafeSqlLike="'%"+SafeSqlLike+"%'"
End Function
Function SafeSqlInt(Var)
If (IsNumeric(Var)) Then
SafeSqlInt=CInt(Var)
Else
SafeSqlInt=0
End If
End Function
Function SafeSqlDate(Var)
If (IsDate(Var)) Then
SafeSqlDate="'"+CStr(CDate(Var))+"'"
Else
SafeSqlDate="'"+CStr(Date())+"'"
End If
End Function
Function SafeHtmlStr(Str)
SafeHtmlStr=Str
SafeHtmlStr=Replace(SafeHtmlStr,"&","&")
SafeHtmlStr=Replace(SafeHtmlStr,"<","<")
SafeHtmlStr=Replace(SafeHtmlStr,">",">")
SafeHtmlStr=Replace(SafeHtmlStr," "," ")
SafeHtmlStr=Replace(SafeHtmlStr,chr(13),"
")
End Function
Function SafeJsStr(Str)
SafeJsStr=Str
SafeJsStr=Replace(SafeJsStr,chr(10),"")
SafeJsStr=Replace(SafeJsStr,chr(13),"\n")
SafeJsStr=Replace(SafeJsStr,"'","\'")
SafeJsStr=Replace(SafeJsStr,"""","\""")
End Function
2009年3月9日 星期一
ASP下載檔案錯誤
這幾天做完BDE10A0000的下載檔案後,上星期測試都ok,但這星期開始全都不能下載了!!原因:不明
上網查了一下,原來是我的存檔方式可能存成OFFICE 2007系列的檔案,在IIS 6.0需要增加對MIME type的支援。
相關參考網址:
http://www.dotblogs.com.tw/puma/archive/2008/03/08/1302.aspx
http://www.izonedesign.co.uk/blog/web-design/download-office-2007-file-extensionsmime-types-with-iis-60/
.docm,application/vnd.ms-word.document.macroEnabled.12
.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotm,application/vnd.ms-word.template.macroEnabled.12
.dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template
.potm,application/vnd.ms-powerpoint.template.macroEnabled.12
.potx,application/vnd.openxmlformats-officedocument.presentationml.template
.ppam,application/vnd.ms-powerpoint.addin.macroEnabled.12
.ppsm,application/vnd.ms-powerpoint.slideshow.macroEnabled.12
.ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow
.pptm,application/vnd.ms-powerpoint.presentation.macroEnabled.12
.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation
.xlam,application/vnd.ms-excel.addin.macroEnabled.12
.xlsb,application/vnd.ms-excel.sheet.binary.macroEnabled.12
.xlsm,application/vnd.ms-excel.sheet.macroEnabled.12
.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltm,application/vnd.ms-excel.template.macroEnabled.12
.xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.template
上網查了一下,原來是我的存檔方式可能存成OFFICE 2007系列的檔案,在IIS 6.0需要增加對MIME type的支援。
相關參考網址:
http://www.dotblogs.com.tw/puma/archive/2008/03/08/1302.aspx
http://www.izonedesign.co.uk/blog/web-design/download-office-2007-file-extensionsmime-types-with-iis-60/
.docm,application/vnd.ms-word.document.macroEnabled.12
.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotm,application/vnd.ms-word.template.macroEnabled.12
.dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template
.potm,application/vnd.ms-powerpoint.template.macroEnabled.12
.potx,application/vnd.openxmlformats-officedocument.presentationml.template
.ppam,application/vnd.ms-powerpoint.addin.macroEnabled.12
.ppsm,application/vnd.ms-powerpoint.slideshow.macroEnabled.12
.ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow
.pptm,application/vnd.ms-powerpoint.presentation.macroEnabled.12
.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation
.xlam,application/vnd.ms-excel.addin.macroEnabled.12
.xlsb,application/vnd.ms-excel.sheet.binary.macroEnabled.12
.xlsm,application/vnd.ms-excel.sheet.macroEnabled.12
.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltm,application/vnd.ms-excel.template.macroEnabled.12
.xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.template
2009年2月7日 星期六
2008年12月1日 星期一
元件在Windows 2000會當掉
我自己在公司的電腦灌了一套Windows 2000英文版,在更新的過程中發現和測試機不同的地方。
原來是沒更新到KB909520
關於KB909520的說明如下:
KB909520 Base 智慧卡密碼編譯服務提供者將軟體更新的描述
這個更新程式可讓多個智慧卡廠商在 Microsoft Windows可使用輕量型專用卡模組而不是完整專用 CSP 啟用智慧卡。
為來自受信任的 「 公開金鑰基礎結構憑證 注意 若要啟用智慧卡大多數的安全性, 使用者必須仍註冊。
請檢查以下檔案日期判斷是否已更新:
Date Time Version Size File name
-------------------------------------------------------
29-Oct-2005 06:49 6.0.5066.164 133,120 Axaltocm.dll
28-Oct-2005 23:40 6.0.5066.160 96,792 Basecsp.dll
29-Oct-2005 06:49 6.0.5066.164 25,600 Bcsprsrc.dll
29-Oct-2005 06:49 6.0.5066.164 151,552 Ifxcardm.dll
29-Oct-2005 06:49 6.0.5066.164 84,480 Pintool.exe
以下作業系統需要更新:
Windows 2000(需套用SP4)
Windows XP
Windows 2003
更新程式會建立下列登錄子機碼:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Microsoft Base Smart Card Crypto Provider
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Calais\SmartCards\Axalto Cryptoflex .NET
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Calais\SmartCards\Infineon SICRYPT CardModule Card
以上資訊來自:http://support.microsoft.com/kb/909520
原來是沒更新到KB909520
關於KB909520的說明如下:
KB909520 Base 智慧卡密碼編譯服務提供者將軟體更新的描述
這個更新程式可讓多個智慧卡廠商在 Microsoft Windows可使用輕量型專用卡模組而不是完整專用 CSP 啟用智慧卡。
為來自受信任的 「 公開金鑰基礎結構憑證 注意 若要啟用智慧卡大多數的安全性, 使用者必須仍註冊。
請檢查以下檔案日期判斷是否已更新:
Date Time Version Size File name
-------------------------------------------------------
29-Oct-2005 06:49 6.0.5066.164 133,120 Axaltocm.dll
28-Oct-2005 23:40 6.0.5066.160 96,792 Basecsp.dll
29-Oct-2005 06:49 6.0.5066.164 25,600 Bcsprsrc.dll
29-Oct-2005 06:49 6.0.5066.164 151,552 Ifxcardm.dll
29-Oct-2005 06:49 6.0.5066.164 84,480 Pintool.exe
以下作業系統需要更新:
Windows 2000(需套用SP4)
Windows XP
Windows 2003
更新程式會建立下列登錄子機碼:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Defaults\Provider\Microsoft Base Smart Card Crypto Provider
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Calais\SmartCards\Axalto Cryptoflex .NET
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Calais\SmartCards\Infineon SICRYPT CardModule Card
以上資訊來自:http://support.microsoft.com/kb/909520
2008年11月20日 星期四
2008年11月13日 星期四
嘗試用C++寫一顆元件發生錯誤
錯誤 1 fatal error C1189: #error : NTDDI_VERSION setting conflicts with _WIN32_WINNT setting c:\program files\microsoft sdks\windows\v6.0a\include\sdkddkver.h 214
沒錯!這就是遇到的錯誤!完全跟我的程式碼無關。看起來像是辨識作業系統版本的問題,卡彈卡超久的。
沒錯!這就是遇到的錯誤!完全跟我的程式碼無關。看起來像是辨識作業系統版本的問題,卡彈卡超久的。
訂閱:
文章 (Atom)