Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 August 4th, 2004, 01:01 AM
Authorized User
 
Join Date: May 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default FSO

Hi
Using FSO how to serach the file and get display
<FORM METHOD=POST id=form1 action="searchresult.asp" name=form1 onsubmit="return Check();">
  Enter text to search for:
  <INPUT TYPE=TEXT NAME=TextToSearch>
  <P>
  <INPUT TYPE=SUBMIT VALUE="Begin Search!" id=SUBMIT1 name=SUBMIT1>
</FORM>
In the text box if enter 's' for example it should list all the files starting with the name 's' in the particular folder


 
Old August 4th, 2004, 04:33 AM
Authorized User
 
Join Date: Feb 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this:

Set Conn= Server.CreateObject ("ADODB.Connection")
Set rsData = Server.CreateObject ("ADODB.Recordset")
Database connection

strsql = Select Name of the field FROM name of your table Where name of the field LIKE '%S'

Do while Not rsData.EOF
<INPUT TYPE=TEXT NAME=TextToSearch Value="<%=rsData("name of your header in your table")%>">

<%
rsData.MoveNext
Loop
Set rsData=Nothing
%>

Hope it help

 
Old August 4th, 2004, 05:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:Originally posted by shopgirl
 Try this:

Set Conn= Server.CreateObject ("ADODB.Connection")
Set rsData = Server.CreateObject ("ADODB.Recordset")
Database connection

strsql = Select Name of the field FROM name of your table Where name of the field LIKE '%S'

Do while Not rsData.EOF
<INPUT TYPE=TEXT NAME=TextToSearch Value="<%=rsData("name of your header in your table")%>">

<%
rsData.MoveNext
Loop
Set rsData=Nothing
%>

Hope it help
Hi shopgirl,
It seems he is looking for help with FSO(FileSystemObject) not related to DB solution.

_________________________
- Vijay G
Strive for Perfection
 
Old August 4th, 2004, 05:35 AM
Authorized User
 
Join Date: May 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi shopgirl ,
I am not asking about the db search i am asking abt the filesystemobject
Set fso = Server.CreateObject("Scripting.FileSystemObject")



 
Old August 4th, 2004, 05:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Here you go...

This should be what you are looking for.

Use this code on the the file to which the form submits, in your case it is "searchresult.asp"
Code:
<%
    txtSearch = Request.Form("TextToSearch")
    Dim fs, f, f1, fc, s
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder(folderspec) 'folderspec=Folder Path, where files reside.
    Set fc = f.Files
    For Each f1 in fc
        If InStr(1,f1.name,txtSearch) = 1 then
        Response.write f1.name & "<br>"
    Next
%>
InStr function returns the position of the txtSearch found in f1.Name(which is file name), as if that is found at 1(starting position of a filename), then you should display it. Check for documentation on InStr and InStrRev functions for more details.

Here is a link to that - The InStr Function

Also one thing to remember, don't post the same topic again and again in same thread or different thread, that would confuse the readers, without knowing which thread was closed or left unattended. Here is the link to the other thread you posted on same topic. FSO, I would suggest you better delete that thread mentioned in the link above.

Hope that helps.
Cheers!
_________________________
- Vijay G
Strive for Perfection
 
Old August 4th, 2004, 05:55 AM
Authorized User
 
Join Date: May 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Vijay,
Thanx for ur info.






Similar Threads
Thread Thread Starter Forum Replies Last Post
FSO issue logidude Classic ASP Basics 5 April 24th, 2007 10:20 AM
FSO help (ASAP) software_developer_kk Classic ASP Basics 1 April 7th, 2005 08:18 AM
FSO question savoym VBScript 3 February 24th, 2005 11:05 AM
FSO - unstable nancy Classic ASP Databases 3 September 10th, 2004 09:52 AM
FSO mikedeepak Classic ASP Databases 0 August 4th, 2004 12:35 AM





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