學弟找我一起去爬山,既然學弟都提出來了,我當然是捨命陪君子啦。
(真的感覺差點掛在山上.......)
第一次爬高山就來這麼硬的。一開始上山的時候感覺右小腿很酸,到下山時變成右大腿很酸,所以下山時我只能右腳先下、左腳再跟上,因為右腳幾乎撐不住啦。
學弟果然是有練過的,我累得快掛了他還有餘裕幫我拍照,太強了!
感想:
過程超級累,心裡想我幹嘛自找罪受,下山後有 "劫後餘生" 的感覺 (我出運啦~~~~)
手機的紀錄:
2016年4月24日 星期日
2016年4月21日 星期四
Capture the output of a script under task scheduler
Reference:
How do I capture the output of a script if it is being ran by the task scheduler?
With stdout and stderr (where most of the errors go to):
cmd /c yourscript.cmd > logall.txt 2>&1
How do I capture the output of a script if it is being ran by the task scheduler?
With stdout and stderr (where most of the errors go to):
cmd /c yourscript.cmd > logall.txt 2>&1
2016年4月11日 星期一
(還願文) 王建民重登大聯盟
其實我並不是個棒球迷,多年前王建民開始上大聯盟,19 勝的時候我才注意到他。
從那時我才開始關心他的戰況,但後來他經常被打爆...
雖然如此我還是在心中默默幫他加油,我在心中許了個願,如果他重登大聯盟我就貼我的 "排骨照"。終於看到王建民重登大聯盟,實在太厲害了!於是我來還願了~~~
從那時我才開始關心他的戰況,但後來他經常被打爆...
雖然如此我還是在心中默默幫他加油,我在心中許了個願,如果他重登大聯盟我就貼我的 "排骨照"。終於看到王建民重登大聯盟,實在太厲害了!於是我來還願了~~~
2016年4月8日 星期五
excel vba sql server select query
Reference:
Query MS SQL Server With Excel VBA
' Before we can start you’ll need to add a reference to your VBA project:
' Microsoft ActiveX Data Objects x.x Library
Option Explicit
Private Conn As ADODB.Connection
Function ConnectToDB(Server As String, Database As String) As Boolean
Set Conn = New ADODB.Connection
On Error Resume Next
Conn.ConnectionString = "Provider=SQLOLEDB.1; Integrated Security=SSPI; Server=" & Server & "; Database=" & Database & ";"
Conn.Open
If Conn.State = 0 Then
ConnectToDB = False
Else
ConnectToDB = True
End If
End Function
Function Query(SQL As String)
Dim recordSet As ADODB.recordSet
Dim Field As ADODB.Field
Dim Col As Long
Set recordSet = New ADODB.recordSet
recordSet.Open SQL, Conn, adOpenStatic, adLockReadOnly, adCmdText
If recordSet.State Then
Col = 1
For Each Field In recordSet.Fields
Cells(1, Col) = Field.Name
Col = Col + 1
Next Field
Cells(2, 1).CopyFromRecordset recordSet
Set recordSet = Nothing
End If
End Function
Public Sub Run()
Dim SQL As String
Dim Connected As Boolean
SQL = "SELECT * FROM QUOTA_Quota"
Connected = ConnectToDB("SQL_SERVER", "DB_Name")
If Connected Then
Call Query(SQL)
Conn.Close
Else
MsgBox "Huston we have a problem!"
End If
End Sub
Query MS SQL Server With Excel VBA
' Before we can start you’ll need to add a reference to your VBA project:
' Microsoft ActiveX Data Objects x.x Library
Option Explicit
Private Conn As ADODB.Connection
Function ConnectToDB(Server As String, Database As String) As Boolean
Set Conn = New ADODB.Connection
On Error Resume Next
Conn.ConnectionString = "Provider=SQLOLEDB.1; Integrated Security=SSPI; Server=" & Server & "; Database=" & Database & ";"
Conn.Open
If Conn.State = 0 Then
ConnectToDB = False
Else
ConnectToDB = True
End If
End Function
Function Query(SQL As String)
Dim recordSet As ADODB.recordSet
Dim Field As ADODB.Field
Dim Col As Long
Set recordSet = New ADODB.recordSet
recordSet.Open SQL, Conn, adOpenStatic, adLockReadOnly, adCmdText
If recordSet.State Then
Col = 1
For Each Field In recordSet.Fields
Cells(1, Col) = Field.Name
Col = Col + 1
Next Field
Cells(2, 1).CopyFromRecordset recordSet
Set recordSet = Nothing
End If
End Function
Public Sub Run()
Dim SQL As String
Dim Connected As Boolean
SQL = "SELECT * FROM QUOTA_Quota"
Connected = ConnectToDB("SQL_SERVER", "DB_Name")
If Connected Then
Call Query(SQL)
Conn.Close
Else
MsgBox "Huston we have a problem!"
End If
End Sub
2016年4月7日 星期四
VBA 消除字串全部的空白
Reference:
HOWTO:使用 Split 函式將區隔的字串放入字串陣列中
Function remove_space(str_in As String) As String
Dim tmp_array() As String
rst_str = ""
tmp_array() = Split(str_in)
For i = LBound(tmp_array) To UBound(tmp_array)
rst_str = rst_str & tmp_array(i)
Next
remove_space = rst_str
End Function
HOWTO:使用 Split 函式將區隔的字串放入字串陣列中
Function remove_space(str_in As String) As String
Dim tmp_array() As String
rst_str = ""
tmp_array() = Split(str_in)
For i = LBound(tmp_array) To UBound(tmp_array)
rst_str = rst_str & tmp_array(i)
Next
remove_space = rst_str
End Function
2016年4月3日 星期日
2016年4月1日 星期五
訂閱:
文章 (Atom)