Search For A String Within A List Of Strings
This is probably simple and I'll kick myself when I see the answer, but I am trying to write a simple if statement that will check to see if a string value is contained within a list of string values. In SQL this is a simple matter with syntax like WHERE status IN ('PT', 'PD', 'PDC', 'DIP', 'TIP') I basically want to do the same thing in my ASP page.
I know I can use code like the following and am doing so now. I'm just looking for a more simple method. Code:
View Replies
ADVERTISEMENT
I have a search function on my site, and what happens at them moment is the user fills in a text box with their search string, and clicks submit. The search page takes their string, and splits it up where it sees " ".
All fairly simple, what I'd like is to allow the user to enter text in speechmarks, so the script would search for a couple of words together, as well as being able to search for every individual word...
Everyone confused yet?!
e.g If the user enters Dev Shed Forums , then the search would look for every occurance of the strings "Dev", "Shed" and "Forums"
What I want is for the user to be able to enter "Dev Shed" Forums, and the search will look for "Dev Shed" and "Forums"...
View Replies
View Related
I need to get data from a string that is like:
2_1
34_1
126_3
I need the numbers on the left in one string and then the numbers on the right that needs to be in a separate string.
View Replies
View Related
Can anyone advice if the following is possible: -
...srch=my&srchlist=search+query&submit=search....etc
srch and srchlist are the names of a textfield, and list/menu
Is it possible to amend the URL, so that the URL QS reads
...srch=my+search+query&submit=search....etc
strSrch = Trim(Request.QueryString("srch")) &" "& Trim(Request.QueryString("srchlist"))
This is the snippet I use to achieve the above example, which is fine, when I use this snippet, and make the &""& without space between the quotes, then it returns: -
...srch=mysearch+query&submit=search....etc
View Replies
View Related
how to loop inside a list? i nid to compare a string if it match on anyitems from my list..
View Replies
View Related
I am passing the following variables....
City - name of city
RentLow - low range of rent
RentHigh - high range of rent
myquery - keywords
The following is the start of my query string but I am having issues with the City portion already and I have not gotten to the rent yet
I know the SQLquery portion right below is fine - it tested perfectly, along with the rest of the query, it was when I added in the request city string that gives me No value given for one or more required parameters. even though one is passed in the string.
SQLquery = "(" &parsethis(strText ,words ,wCount, 3) & ")"
SQLquery = Replace(SQLquery, "<FIELD1>", "title")
SQLquery = Replace(SQLquery, "<FIELD2>", "description")
SQLquery = Replace(SQLquery, "<FIELD3>", "comments")
SQLstr = "SELECT * FROM links WHERE " & SQLquery & " AND city = " & Request.QueryString("city") & " AND linktype = 2 AND active = " & myTrue & " " & SortSQL & ";"
end if
View Replies
View Related
i ve a string like this : my_name_is_ahmed_adly
now i need to see if this string contains the word "is"
so how can i do this ?
View Replies
View Related
if i have a string with comma seperated words. is there a way to search another string for words that are in it?
View Replies
View Related
I have a page that is not asp that is linking to an asp page with a question mark and a variable on the end of the URL. How can I pull the variable off using server
side processing only?I have tried using ServerVariable("HTTP_REFERER") no good, I tried ServerVariable("URL") no good. I am also using Instr(var,"?") to search the url string like this.
Red1 = Requestor.ServerVariable("URL")
Test1 = Instr(Red1,"?")
Test1 is always a 0 because Red1 is always just the refering URL and I need the whole string in address field. I think that I am using the wrong property but I am not sure what is the right property.
View Replies
View Related
Is there any fast way to search for a specific string within all the files in a folder at a same time?
View Replies
View Related
I am having some trouble with getting reliable results with a search string I am using in an ASP page that uses embedded SQL.
In the ASP page, I am using checkboxes for the user to select states to search for records that apply to the selected states. Let's say that I checked the states of [GA][VA][TN]. And, let's say that there is a record with a column "states" which has the states of "AL,GA,FL,VA,TN".
The search criteria I use above will not return that record. However, If I use a search criteria that satifies the leading value of "states" or the trailing value of "states" the result will be returned. But since my search criteria 'breaks apart' the actual value of "states", it is not returned in the search. Why, and how can I make this work better?
View Replies
View Related
I've made my first ASP website that interacts with a detabase. All fairly standard: it can display the entire contents of the db, you can input new items, update and delete items, and I've just started making a search page...[!]
It all works fine if the user just searches with one word, but if they enter more than one word and then press search, I don't know how to split their searchstring up into [an array of?] different strings to search the db with.
Is this even the easiest way to do it, or am I just wasting my time?
View Replies
View Related
I am creating a search page and need help writing the code to build the sql
string.
I have 3 fields on the main page which a user can choose to enter search
terms in any of the 3 fields. My question is how do I write the logic so it
only includes the fields in the search criteria where the user has entered
anything.
Fields are
Production No
Production Title
Synopsis
The user may enter any, all or some of the search teams in the fields.
On the search page I am using lots of if conditions to build my sql string
like
strSQL = "Select * from Productions where "
now after where there are lots of permutations and combination like
production no could be empty or it could be filled in and the other fields
might be empty or filled in as well.
Does someone has a simple logic to build the correct sql String?
View Replies
View Related
I'm trying to split my search string, So I can compare search results if the string was of two words such as: "world news"... But i'm a bit confused of how to do it using this code (FOR EXAMPLE): ....
View Replies
View Related
I'm trying to use the Microsoft Search to search for a text string in a folder full of a bunch of ASP files. Seems like the normal "Search for text in files" program in XP Pro won't search between the ASP delimiters <% %> .
How can I search for text strings in ASP a folder full of ASP files with out opening each one individually and searching?
View Replies
View Related
In a HTML form field, the user enters a long text. I need to search for an image tag. Then get the name of the image (*.gif or *.jpeg) to check the image library if the image already exists. If exists, cannot upload the image. Else, upload the image.
View Replies
View Related
Is it possible to search a string for a upper case character? Here is what I am trying to do:
I have the following string:
Quote: str = "ProjectSectionPlanning"
I'm trying to break this string into:
Quote: str = "Project Section Planning"
View Replies
View Related
I want to search a string of HTML and insert a querystring into any url where the url is an asp page and is either a local link /folder/page.asp or of a specific domain http://www.somedomain.com/folder/page.asp. It needs to be able to handle plain links and those with querystrings already in there.
I could do it with instr functions etc but I thought this might a good time to brush up on regular expressions. Can anyone point me in the right dirction?
View Replies
View Related
what I would like to do is remove a substring from a full string and display the modified string my basic code should be some like this:
strSearchString = FullString
strSearchFor = "SubString"
If InStr(1, strSearchString, strSearchFor) > 0 then
Response.write (FullString - Substring)
does anyone have any idea how I would go about doing this?
View Replies
View Related
How can i list out all the email address into my website from the hotmail caontact list? i am successful log in into the yahoo contact list by using serverxmlhttp and list out all the email address from the page source, but i could not access to hotmail by using the serverxmlhttp. Is any other methos can list out the email address from hotmail contact list?
View Replies
View Related
In a string what is the character I should use to represent an enter?
View Replies
View Related
i am retrieving a record from the database, I am trying to place the value of the FULLNAME field in a textbox on a Form, the Problem is that it only displays half of the name leaving out the stuff that comes after a SPACE.
Example:
adors("fullname").value <--- Actual Value is John Smith
but it only displays John
Code:
<INPUT id=text1 readonly name=txtfullname value=<%=adors("fullname").value%>>
but if I try to just response.write it anywhere on the page then it displays the entire name.
View Replies
View Related
I have 2 SQL strings:
SELECT *
FROM NK_editie " & MM_whereConst & " " & whereClause & "
ORDER BY editie desc
And
SELECT *
FROM NK_editie INNER JOIN NK_edities ON NK_editie.editieid = NK_edities.ID
ORDER BY editie desc
Now I want to combine those 2 to one string.
I have problems to set it up in working order.
My tryout:
SELECT *
FROM NK_editie INNER JOIN NK_edities ON NK_editie.editieid = NK_edities.ID &
" & MM_whereConst & " " & whereClause & "
ORDER BY editie desc
It shows al the records which are joined, only the second string " & MM_whereConst & " " & whereClause & " is not working.
View Replies
View Related
I found out a really nice way to keep things on the same page is for any processing page to add on a "?<something>=<something>"
and then just check to see what the something is equal to, and the number represents what you want the front page to show.
However, this <something> shows up on the url listing in a browser. Is there anyway to .. encode it so no one can see it? Like a encode/decode function?
View Replies
View Related
I'm building a forum, and right now i'm creating the ability to edit posts. As part of this i want to add the usual "Edited by UserName on Date" line at the bottom, but am having problems doing so.
The problems seems to do with formatting the text in the variable with <span>s using stylesheets, or if there are " and ' markes in the post proper (which I can't seemt to remove with Replace). Here's my code:
View Replies
View Related
if i had a string which looked like this :
,apple, orange, grape, tomatoes
how do i remove the first character[,] from the string using the trim() function?
View Replies
View Related
I am developing a website and it's going fine, but i've heard that you shouldn't have your database in the wwwroot, it should be outside/above that.
I've done this (i'm using Dreamweaver MX) so I moved the db, fixed my odbc/dsn, connection string etc, but when I upload now I get this error.
Microsoft JET Database Engineerror '80004005'
'C:Program FilesEnsimSiteDatawebpplianceconfdomainsInet pubwwwrootTesting_SiteDatabasesTesting_Website _DataSource.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides. /Testing_Site/default.asp, line 8
This is line 8: Recordset1.ActiveConnection = MM_TestingConnection_STRING
Is there something that I have missed. It was ok when it was in the wwwroot.
View Replies
View Related
i am having a problem with comparing two strings. I am taking
in the parameter rs("Company") and if this is empty i want to put some
text in there. I am testing it with an empty Company field and comparing
it like so:
temp1=rs("Company")
temp2=StrComp(temp1,NULL)
I have also tried it with
temp2=StrComp(temp1,"")
but each time i get nothing returned. Is there some rule about comparing a
string with an empty string?
View Replies
View Related
I am using ASP to connect to a simple database to retreive information and also to imput information.What I need is a simple dns connection string syntax to connect and query data.
View Replies
View Related
I have a list of dates in a sql database that are input as varchar like this 042999
How do I insert / in between the date/month and year
so this 042999 will appear like this 04/29/99
View Replies
View Related
if i've two strings like:Code:
dim pic_name=replace(Request.Form("pic_name"),"'","''")
dim pic_path="pro-details/PICs/"
how could i merge the two strings to get the complete pic-path
View Replies
View Related
< input type=text name="PageTitle" id="PageTitle"
value="<%=strPageTitle%>" >
How do I "escape" any quotes, accidental carriage returns etc that are
contained within strPageTitle? Do I have to use a series of replace()
functions, or is there a cunning way that makes it OK?
(Using escape(strPageTitle) fills the box with % signs...)
View Replies
View Related
I have 2 string
str1="John"
str2="Smith"
I need to join them and then i need to get 6 characters from the left
so here is my code
str3=str1&str2
str4=Left(str3, 6)
I need to see the output as johnsm
but it gives the output as john
View Replies
View Related