Created
March 17, 2014 23:25
-
-
Save seraphy/9610484 to your computer and use it in GitHub Desktop.
ADODB.RECORDSETを使った非接続型、オンメモリの仮想テーブルの作成方法
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
option explicit | |
dim rs | |
set rs = CreateObject("ADODB.Recordset") | |
with rs.Fields | |
.Append "IDX", 3 ' integer | |
.Append "VAL", 200, 50 ' varchar(50) 文字列は長さ指定必要 | |
end with | |
rs.Open | |
dim idx | |
for idx = 0 to 10 | |
rs.AddNew | |
rs.Fields("IDX") = idx | |
rs.Fields("VAL") = "Hello" & idx | |
rs.Update | |
next | |
rs.Filter = "IDX > 5" | |
rs.Sort = "VAL DESC, IDX DESC" | |
rs.MoveFirst | |
do while not rs.EOF and not rs.BOF | |
MsgBox rs("IDX") & "=" & rs("VAL") | |
rs.MoveNext | |
loop | |
rs.Close | |
msgbox "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment