
Hola amigos. A ver la solidaridad como anda..!
Bien: tengo un recorset que se crea con fso. Me lista todos los archivos de una carpeta, y yo
Necesito insertar esos registros en Access
Basta de cháchara! acá está el código, valientes!
<%
'**********
'kc_fsoFiles
'Purpose:
' 1. To create a recordset using the FSO object and ADODB
' 2. Allows you to exclude files from the recordset if needed
'Use:
' 1. Call the function when you're ready to open the recordset
' and output it onto the page.
' example:
'Dim rsFSO, strPath
'strPath = Server.MapPath("\ordenes\FSO\Stuff\")
' Set rsFSO = kc_fsoFiles(strPath, "_")
' The "_" will exclude all files beginning with
' an underscore
'**********
Function kc_fsoFiles(theFolder, Exclude)
Dim rsFSO, objFSO, objFolder, File
Const adInteger = 3
Const adDate = 7
Const adVarChar = 200
'create an ADODB.Recordset and call it rsFSO
Set rsFSO = Server.CreateObject("ADODB.Recordset")
'Open the FSO object
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'go get the folder to output it's contents
Set objFolder = objFSO.GetFolder(theFolder)
'Now get rid of the objFSO since we're done with it.
Set objFSO = Nothing
'create the various rows of the recordset
With rsFSO.Fields
.Append "Name", adVarChar, 200
.Append "Type", adVarChar, 200
.Append "DateCreated", adDate
.Append "DateLastAccessed", adDate
.Append "DateLastModified", adDate
.Append "Size", adInteger
.Append "TotalFileCount", adInteger
End With
rsFSO.Open()
'Now let's find all the files in the folder
For Each File In objFolder.Files
'hide any file that begins with the character to exclude
If (Left(File.Name, 1)) <> Exclude Then
rsFSO.AddNew
rsFSO("Name") = File.Name
rsFSO("Type") = File.Type
rsFSO("DateCreated") = File.DateCreated
rsFSO("DateLastAccessed") = File.DateLastAccessed
rsFSO("DateLastModified") = File.DateLastModified
rsFSO("Size") = File.Size
rsFSO.Update
End If
Next
'And finally, let's declare how we want the files
'sorted on the page. In this example, we are sorting
'by File Type in descending order,
'then by Name in an ascending order.
rsFSO.Sort = "name asc"
'Now get out of the objFolder since we're done with it.
Set objFolder = Nothing
'now make sure we are at the beginning of the recordset
'not necessarily needed, but let's do it just to be sure.
rsFSO.MoveFirst()
Set kc_fsoFiles = rsFSO
End Function
'Now let's call the function and open the recordset on the page
'the folder we will be displaying
Dim strFolder : strFolder = (Server.MapPath ("\ordenes") & "\"&fcount&"")
'the actual recordset we will be creating with the kc_fsoFiles function
Dim rsFSO 'now let's call the function and open the recordset
'we will exclude all files beginning with a "_"
Set rsFSO = kc_fsoFiles(strFolder, "_")
'now we'll create a loop and start displaying the folder
'contents with our recordset. Of course, this is just a
'simple example and not very well formatted, i.e., not in
'a table, but it gets the point across on how you can
'ouput the recordset on the page.
While Not rsFSO.EOF
%>
<form name="form1" method="post" action="">
<table width="100%" style="
BORDER-bottom: rgb(102,102,102) 1px solid width="100%">
<!--DWLayoutTable-->
<tr>
<td class=le_ch width="81" height="124"> <div align="center">
<input class=in_contac type="checkbox" name="<%= rsFSO("Name").Value %>" value="<%= rsFSO("Name").Value %>">
<br>
<%= rsFSO("Name").Value %>
<input name="nom" type="hidden" id="ver" value="<%= rsFSO("name").Value %>
<%= rsFSO("TotalFileCount").Value %> </p></td>
<td> <div align="center">
</div></td>
<td width="174" valign="middle" class=le_az> <p align="center"><img src="http://www.zoomlab.com.ar/ordenes/<%=fcount%>/<%= rsFSO("Name").Value %>" width="120" border="1" bordercolor=cccccc id=ipreview></p></td>
<td width="108"> <p align="center">
<select class=in_contac name="<%= rsFSO("Name").Value %>">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<br>
</td>
<td width="93"><!--DWLayoutEmptyCell--> </td>
</tr>
</table>
</form>
<p>
<%
'and let's move to the next record
rsFso.MoveNext()
Wend
'finally, close out the recordset
rsFSO.close()
Set rsFSO = Nothing
%>
LA IDEA ES VOLCAR AL MENOS EL NOMBRE DE LA FOTO EN UNA DB
MUCHAS GRACIAS POR SU VALIOSA AYUDA