Command To Find Substring In A String
does exist any command to find any substring in a string ? for example if i want to find if there is any + in a string , how can i do this ? Code:
View Repliesdoes exist any command to find any substring in a string ? for example if i want to find if there is any + in a string , how can i do this ? Code:
View Replieswhat 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?
I have this sentence
"I like to eat apple"and I need to change it to "i like to eat orange"
i have to check either the string contain apple or not. If yes, then i need to replace the "apple" to "orange" else i done nothing to the string.
can anyone show me how to write this in asp code?
How can i count the number of times a string appears within another string.
View Replies View Relatedi have a string and want to find the position of the first '-' in it.
example i have :
"RCD-0-183"
I need to output : 0-183
I have a small script were a variable called "MyURL" is used
MyURL = "/xxx/yyy/zzz/"
Now I want to find it's parrent URL. The result should be
ParrentURL = "/xxx/yyy/"
What is the easiest way to achieve this?
I am trying to make our website a bit more dynamic. one of the ways i want to do this is to be able to put in ASP code into our MySQL database (the code would be different for every company) and have it execute when the page is brought up.
We have the potential of having thousands of companies using our website, so having it hard coded will be hard to maintain, and having it save to a file will become cumbersome if there are too many users. Anyone have any ideas on how to execute a piece of ASP code straight from a string varaible?
I have records from the database for locations as "Baltimore Service center","Vancouver Service center", "Toronto Service center"...etc.I am trying to get a substring where it diaplays just the location and strips Service center ex : Baltimore
View Replies View Relatedi want to use substring function to peel of first two characters stored in a database field. i'm using sql. im not quite sure what the syntax will be.
Const strSQL as String = "SELECT SUBSTRING(emailKey,2,4), primaryKey FROM Tracker"
i kinda figured out the above statement doesnt work. all i want is extract the first two letters from the emailKey field. any help?
I am getting the above error when trying to execute the following code:
View Replies View RelatedI have an online application. I get the following error when a user selects an option from one drop down list but doesn't select an option from another drop down list. Here is the error:
Microsoft OLE DB Provider for SQL Server error '80040e0c' Command Text was not set for the command object. Code:
I have an online application. I get the following error when a user selects an option from one drop down list but doesn't select an option from another drop down list. Here is the error:
Microsoft OLE DB Provider for SQL Server error '80040e0c'
Command Text was not set for the command object.
Line 87
Line 87 = rs1 = conn.execute(finalSQL)
Here is the page causing the error. Code:
I keep getting this error. I searched the forums, and found one. It said to basically replace elseif with else. It worked for that person.
I tried it and it didn't work. So what i decided to do was, remove all of the if statements and keep one. Even with just one if statement i get the same problem. Does anybody know what is wrong? It worked fine, up until i added the if statement. I need them there though for a reason.
Personally i think, it;s not getting the value from the request form, and hense it isn't picking anything up. What do you lot reckon? Code:
I am getting the above error in an asp page. Not sure why? The error details is given below. Code:
View Replies View RelatedI'm developing an Asp.NET system to take a CSV file uploaded via the web, parse it, and insert the values into an SQL database. My sticking point comes when I try to split() the string returned by readline() on the file.
The following code snippet works for me:
tokens = "one,two,three,four".Split(",")
for each token in tokens
response.write("<td>"+token+"</td>")
next
However, if I take the next line in the CSV, read using StreamReader.ReadLine on the PostedFile.InputStream, I receive "Object reference not set to an instance of an object." which I have narrowed down to be my string holding the line. Further investigation reveals that no other string member functions work on my line (.ToCharArray, .ToString, etc).
I suspect that StreamReader.ReadLine is not correctly returning a string, even though Response.Write(line) displays what I would expect .....
However, when i opened a page on my pc the database string was:
DBFolder = path & "..mysqldataformuladata
I cant find the folder in question. Even when ftping.
Any ideas where is could be lurking?
I am trying to locate a file using the following code
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
strURL = "http://server/ApprovedAutoCAD/140-00007-01.dwg"
objXMLHTTP.Open "GET", strURL, False, "login", "password"
objXMLHTTP.Send
strReturn = objXMLHTTP.status
I get a 404 status back indicating that the file is not found, which is incorrect. I am able to locate XLS and DOC files on the same directory. Any ideas why I cannot find a DWG (Drawing) file?
I am not sure if this is a question for this forum or the IIS forum but here goes. I have a dedicated server on which I am hosting about 80 websites at the moment, all of which have been created by copying a template site. All of these sites have an identical structure and are located in the same directory on the server, C:Inetpubvhosts. Several times when I have needed to make an adjustment to the sites I have to go into the remote desktop connection to the server and go site by site, copying and pasting files. For example, as each site has the same pages, ie., map.asp, sometimes I make a change to that page and have to copy it to every site. Could I write some sort of script using the FSO and execute it from one site and have it loop through each site on the server making the neccessary change(s)?
View Replies View Relatedif i use the physical path where the database is located then my code works fine
such as ("e:folderabc.mdb")
but when i use the server.mappath("abc.mdb") , i get error
The dreaded missing end statement
I need another set of eyes mine are about to cross.
My Error
Microsoft VBScript compilation error '800a03f6'
Expected 'End'
calendar.asp, line 289
My code:
We have several pages that are running very slow, is there any way to
identify which pages are taking the longest to process?
At first glance, the question in the subject line seems way too easy. But I
am finding some situations in my app where the value in a variable is some
sort of blank-like value, such as Null or " " or "", but I cannot tell
which.
Of course, in order to find out the value, I did a response.write, and added
a nonsense word afterward, to help make sure it is writing it out for me.
First, I tried to check for null: Code:
How do I go about testing to see if a value is not equal to NULL? isNULL provides the opposite functionality, but all my attempts at the former return a FALSE value.
View Replies View RelatedI want to know how to find out who is sending visitors to my site. So i obviusly need to find out who a visitors referer is.
I took a guess and thought that this is what I should use:
request.ServerVariables("HTTP_REFERER")
But that does not return anything. Any ideas guys?
Based on what the user selects in a combo box I need to find the value from another column in the same record. This is what I am using:
rsPrice.movefirst
rsPrice.Find "Component='Desktop'"
If (rstPrice.BOF = True) or (rstPrice.EOF = True) Then
response.write("The Price for the Component Not Found")
else
curPrice =rsPrice("Score")
End If
I keep getting an error messages:
Microsoft OLE DB Provider for SQL Server (0x80040E29) Rowset does not support scrolling backward.
can u tell me how to find the quoteint in asp
for e.g
290 / 100 = 2
I want result 2 but it gives 2.9
where i can get very professional and sophisticated images for my web sites ( even if i have to pay for them )
View Replies View RelatedI'm coding in classic asp and can't figure how to get IE6 to display some kind of descriptive message about code errors? I have the correct settings under ADVANCED in IE's options selected.
What bugs me is sometimes IE will report the line number and a message, and then other times it's the standard "The page can't be displayed." When you have hundreds of lines of code, how can you fight this?
i have 2 columns. called wintersubjects,summersubjects . the data in the columns will be 4 subjects.
maths
science
arts
social science
i want to find out the count for all of them.
I am attempting the following for a real estate website. I want to list the agents for the office all of whom have a unique identifier with an Auto Number type. As I loop through the recordset, I also want to open another table called listings. This table has a field called agent whose value is a number and corresponds to an agent in the agent table.
If there is a listing in the listing table, I want to insert a link to "View Listings", if not, no link. I am having a hard time doing this and if someone could point me in the right direction I'd appreciate it. I tried the Find method but to no success.
I want to find numbers in one comma seperated string which are not in another one. For instance if I have two strings "strString1" and "strString2 how can I find numbers in "strString1" which are not in "strString2" Example:
strString1 = "1,3,6,12"
strString2 = "1,6"
In this case the numbers I want to end up with are 3 and 12.
I am working on a survey and I have gotten the pages done to collect the data but now I am having trouble finding the correct syntax for displaying some of the data back to the user. I basicly need one to do this
Text on site <field1*field2*1.5> More Text on site.
and a seperate one to do this:
if field1=a then write "message one"
if field2=b then write "message two"
I'm working on something at the moment which pulls through a url to another page if it exists. I've got that bit working.
The bit I don't know how to do (real asp beginner here) is to check if the url has http:// in it, and if it has, remove it.