Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional 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 29th, 2004, 08:35 PM
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 server.mappath()

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








%>







Similar Threads
Thread Thread Starter Forum Replies Last Post
objFSO, Server.mappath, etc in this book? cJeffreywang BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 September 12th, 2007 04:54 PM
Server.mappath and concatenation MArk_dB Classic ASP Basics 5 March 6th, 2007 03:48 PM
Server.MapPath johanyu ASP.NET 1.0 and 1.1 Basics 0 October 19th, 2004 12:42 AM
Server.MapPath stu9820 Classic ASP Basics 1 January 9th, 2004 04:16 PM
server.mappath kyootepuffy Classic ASP Databases 1 September 5th, 2003 04:17 PM





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