Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 28th, 2004, 09:36 AM
Authorized User
 
Join Date: Oct 2004
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kiwibey
Default set variable for map path...

hi everybody,
i'm try to do a system which user can choose folder for the system copy all the file name inside the folder to database...
that mean user can select which folder there want ( mean insert a variable in )
<set fo=fs.GetFolder("C:\bey\datachecklist\DataCheckLis t\DataCheckList\compare\")>
so everytime user can select which folder filename want to insert to database..

my coding is as below for copy file from folder to database :

<%
dim fs,fo,x
set fs=Server.CreateObject("Scripting.FileSystemObject ")
set fo=fs.GetFolder("C:\bey\datachecklist\DataCheckLis t\DataCheckList\compare\")
Dim objFSO, objTextFile
Dim sRead, sReadLine, sReadAll
Const ForReading = 1, ForWriting = 2, ForAppending = 8


    Dim Conn_str, rs, SQL
    Set Conn_Str = Server.CreateObject("ADODB.Connection")
    Conn_str.Open "Provider=SQLOLEDB;Data Source=stardocs-1foniw;UID=sa;PWD=sa;DATABASE=checklistsystem"
       'Print the name of all files in the test folder
      'Set objFSO = CreateObject("Scripting.FileSystemObject")
    'Set objTextFile = objFSO.CreateTextFile("C:\bey\datachecklist\DataCh eckList\DataCheckList\compare\try.txt", True)

for each x in fo.files


    'objTextFile.Writeline(x.Name)

      'Response.write(x.Name & "<br />")
  session("filename") = x.Name
  session("date") = date()
  Set rs = Server.CreateObject("ADODB.Recordset")
  SQL = "insert into try(filename,date) values('"&session("filename")&"','"&session("date" )&"')"
  set rs = conn_str.execute(sql)

     next
    set fo=nothing
    set fs=nothing








%>


 
Old November 29th, 2004, 08:58 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default



   Already posted at

http://p2p.wrox.com/topic.asp?TOPIC_ID=22776








Similar Threads
Thread Thread Starter Forum Replies Last Post
Map Path??? thetwai C# 3 April 5th, 2007 07:26 AM
Error: File path and URL http map differently cJeffreywang ASP.NET 1.0 and 1.1 Basics 4 March 27th, 2007 08:03 PM
Object variable or With block variable not set tparrish VB Databases Basics 1 May 25th, 2005 10:25 AM
FSO Map.Path points to development site nancy Classic ASP Basics 0 April 27th, 2005 01:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.