Created
August 30, 2014 16:16
-
-
Save anonymous/9c2a408bab050f89469d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub test() | |
Dim cnn As New ADODB.Connection | |
Dim rst As New ADODB.Recordset | |
Dim preDayID As Long | |
Dim preClosePrice As Double | |
Dim sqlStr As String | |
cnn.Open "Driver={MySQL ODBC 5.3 Unicode Driver};" & _ | |
"Server=hogehoge;" & _ | |
"Database=hogeDB;" & _ | |
"Uid=hoge;" & _ | |
"Pwd=hage" | |
strSQL = "SELECT 終値, id, 前日終値 FROM t_db where id between 130100000 and 200000000 order by id" | |
rst.Open strSQL, cnn, adOpenForwardOnly, adLockPessimistic | |
Do Until rst.EOF | |
If rst("id") = preDayID + 1 Then | |
rst.Update "前日終値", preClosePrice | |
End If | |
preDayID = rst("id") | |
preClosePrice = rst("終値") | |
rst.MoveNext | |
Loop | |
rst.Close | |
cnn.Close | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment