Im looking for a way to replace certain chacters in a variable. this will be used for a file name. currently im using Code:
strFileTitle = Replace(strGuideTitle, " ", "_")
But this only kind of works because as ive erperiented more i also need to remove most chancters which would make an image file name invalid such as : ; / & ' " and a few others which users may enter regulary.
I have several isbn's that are eather 10 or 12 charcters long. I need to insert a dot . after the fifth character if it is 10 long, and after the 6th character if it is 12 long. How do I count through the string and find out if it is 10 or 12 charaters long, then insert the dot . after the first 5 if it's 10, or after the first 6 if it's 12?
I know there is a way of stripping out special characters from a string however I need a way of stripping out "" marks from a string or what i really want is to replace all double ("") marks in a string with single ('') marks before inserting the string into a database. Is there a way of doing this in ASP?
But I can't find the same way to do it in vbscript using ASP! I simply want to strip the last four characters, but leave the rest of the string in tact! As the string could be any length, I don't know a start position.
I have this bit of code that stores the current web page address in a Session variable. I want to always remove the last four characters, such as E.asp, or G.asp, or I.asp.
I searched tutorials on string manipulation but all seem to take out a string in the middle of a string and replace it with something. I just want the last 4 characters removed.
I'm trying to strip out none alphanumeric characters (and a couple of punctuation marks) from a string before inserting into a database.
I've put in my code below, basically I thought I'd loop through each character in turn and pass it through a regular expression to check its validity. If it passes I'll add it to a global variable ('validString') if it fails I'll remove it.
But I can't get my Mid() function to accept 'i' as a value so it won't loop. Code:
what is the maximum number of characters that a string variable can hold - i initially thought it was 256, but after some testing it seems that it can hold much more than that..
I am trying to simply pass a variable set by 1 recordset into this string. The nOrderID variable is passed no problem but the nProductID remains empty.
I have checked that the variable contains a value by doing a response.write before the string is executed and it contains the number I was expecting, but when I do a response.write of the SQL String it writes out as expected but misses the variable value at the end.
This must be a simple issue but I can't spend much more time fixing it,? The SQL String is below:
I am calling function of vb dll from asp. How do i declare the arguments to be passed of string datatype. I tried using Dim but its giving me error. I want to explicitly declare three variable as string.
I have a batch file that takes variables from the cmd and passes them by sqlcmd to an SQL script. When I pass the variable 'MikeTestList' the script runs as expected with no problems. When I passed 'BulkTransferTest' I got an error message, 'The string or binary data will be truncated'.
Some testing has shown that I get the error when the string is anything above 12 characters. Is there a limit to the length of a string you can pass using sqlcmd from a batch file? Is there any way around it?
Also, if I have a space in the string, it only passes the string up to the space. I have tried to fill it with a '%' which then gets passed as is, so the % stays in place through out the script. Code:
I'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 .....
I have a form in which several elements are expected to be all digits. Some of those elements can be left empty, but if specified they must be all digits. I have this Sub to edit them: ....
I am pulling info from a sql server By default the query pulls back the inforamtion as text.Therefore when I go to calculate some figures its giving me a type mismatch error. Is there a function in can call to convert a text string to an integer string using
rstSearch.Fields("name").Value .To pull back the info in a for loop
Error Type: Microsoft VBScript runtime (0x800A000D) Type mismatch
Anyone in here got an idea how i could limit the display on on a paragraph to 50 characters? because everytime I access the database it would show up the entire paragraph.
I have the character & (username is a&d) in a username in one of my database fields and it won't read it properly. Do you have to do something special with characters like that?
sqlString = "SELECT * FROM Users WHERE UserID=" & "'" & userid & "'"
I got that right now but i want the variable, console to be placed along with news so when it selects from the db it selects from gcnnews or whatever variable it's on. How do I do that?
I need to assign a value to a variable, but this variable name is dependant upon another variable!! I am including the code below so you can see it, cos if not I am sure you are thinking whattt?? Code:
I have a MS SQL 7.0 table with a large field (> 500 characters). My select statement embedded in my ASP file in an intranet web interface only returns 255 characters. If I run the select statement in Query Analyzer, I can easily change the "Maximum Characters per Column" setting to return the entire field, but that doesn't help me in my ASP web interface. How do I return the entire field through ASP?
What I am trying to do could be simple but I have no idea how to it. I am trying to display only a part of the record retrieved from database. I have retrieve data from database and I show it in normal way <% = oRs(0)%>, the problem is that I want to show only 100 first characters and then make some thing like this … after 100 first character. In this way all the data retrieved would look the same in the page.
One of our offices in AD is called "Albert St", the OU is called "Albert St", but when I retrieve the value out of the list box it becomes "Albert" and throws errors as it cant find the "Albert" OU. Not surprising, really. I am going to try type casting, but beyond that
I have a wee lil problem when I am inserting data into my db from my asp page. The problem is that it is inserting unwanted characters with the values. I have used the following to try and remove the unwanted characters but to no avail: Code:
I have a variable I'm pulling from a database that's a phone number in XXX-XXX-XXXX format. What I'm looking for is a way to strip out all non-numeric characters from the variable (XXXXXXXXXX). I don't want it to look only for "-", since sometimes, there are also alpha characters entered as well.