Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 29th, 2004, 08:35 PM
Authorized User
 
Join Date: Oct 2004
Location: Kuala Lumpur, Wilayah Persekutuan, Malaysia.
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








%>


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:12 PM.


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