creating ado recordset from fso object
i have a fso object the gets all files in directory. i want to create a recordset of the file name, size and date created so i will be able to sort the recordset by date.
what i tried is:
Dim rs
set rs=Server.CreateObject("ADODB.recordset")
-----------> rs.fields.append "Name", 201
rs.fields.append "Size", 201
rs.fields.append "Date", 7
RS.Open()
fld1 = R开发者_JAVA技巧S.Fields("Name")
fld2 = RS.Fields("Size")
fld3 = RS.Fields("Date")
rs.close
i get error: Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another on the with the arrow
NEVER MIND: error was for reserved words
sulution is to have the name of the field in "[" and "]"
After .Open
you must .Addnew
in order to create a row to which you can assign your values.
Also I would use rs.fields.append "Size", 201, 255
(200=advarchar; 255=max len) instead of the longvarchar 201 which iirc is implemented as a blob so is not as performant.
精彩评论