Formating Strings
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
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
I would like to format URLS that are being retreived from a database. Here is an example:
bodytext="this is some text http://www.sitepoint.com/ this is some more text"
response.write(bodytext)
how could I change the URL (http://www.sitepoint.com/) to a link? So instead of http://www.sitepoint.com/, it would be <a href="http://www.sitepoint.com/">http://www.sitepoint.com/</a>. There are going to be an infinate amount of URL's (the user can type in any one) and it is just not the URL by itself.
I want to be able to format a year as mm/dd/yy
formatdatetime does not work because the year is yyyy. How do I format a 2 digit year such as 04 for 2004?
When i send a text string to my database linebreaks are stored, but when i call it from asp to the page all linebreaks are lost.
this will reformat text to look different than i was initially typed, how can i make the text shown on webpage in orginal formating.
hope im clear on this or ask and i will elaborate.
does anyone know if there is a function to format date?When my date is extracted from database, it is in decimal format (ie.38233.72078), is there a way to convert this number to date formate using asp?
View Replies View RelatedHaving a pretty annoying format 'error'
The below code works fine,
strMessage = "Logged in as: " & Session("UserName") & ""
but it displays as:
Logged in as:
'Username'
Were as i want it to be:
Logged in as: 'Username'
Any ideas how to make it go to one line?
I posted before about replacing special characters (esp. '). However, I am wondering how formatting can be kept when entering it into a textbox to store in a database?
When text with seperate paragraphs is entered, it comes out as one big paragraph later on.Is there anyway to address this? When I was doing my searching - somethign about chr(10) kept coming up, but I am not sure what this is.
I have an ASP page taking data from a table. I would like that the data is shown as a % (like 51.456897%) All it shows with my code below is 0.51456897.
Can someone tell me how to change the code so that my % is shown? ....
I am importing a time into a sql datetime field from a text datafile using vbscript in an asp file. The time coming in will look like 8:00 or 3:30 or some other similar thing.
Because it is doesn't have am or pm associated with it, I have to force the issue or sql will assume am all of the time, and I am sure that no judge in our county is going to hear a case in the middle of the night!
So I have to add 12 hours to anthing that could be an afternoon time before I add it to the database to keep it from looking stupid in the display screens.
if we use formatnumber library function in asp it will format the no as per the number format defined in the locale of the server. For example:
some number format look like this 34,135,200 (comma seperated)
some looks like this 34 135 200(blank spaces seperated)
so does anybody have a vbscript function which do this job.
I have the following variable being displayed but i would like it displayed in the default font and text size 2 how is it done?
<% response.write(sUserId) %>
Is there a way to output a date in latin american format?
You know the day first, the month second and the year last.
I have a report that will format a number to the last 2 decimal places. However it will trim off the 0 at the end. Example.
98.90 is formated to 98.9
how can i tell the format number function to not trim the 0 but still have the last 2 digits.
I am storing dates in a mySql database in the format yyyy-mm-dd. Now, I have set up so that this field is insert by a form.
It isn't very user friendly to have to type yyyy-mm-dd, how can I set up so that the user can enter format dd/mm/yyyy and it will automatically insert into the database as yyyy-mm-dd? I am using Dreamweaver MX 2004 and ASP.
I have a querystring that passes through the value 001 for example, the form on the receiving page need to display that number but with 1 added to it. i have
dim strnum
strnum = request.querystring("value")
strnum = strnum + 1
when displayed <%=strnum%> shows 2 instead of 002, and the zero's are very important, is there any number formating trick i dont know or another way of doing this?i thought about coding the first two zero's in before i call the strnum but this would mess things up when i get to 010 etc.
In a string what is the character I should use to represent an enter?
View Replies View Relatedi 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.
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.
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?
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:
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?
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.
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?
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 RelatedI 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"...
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
< 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...)
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
I am storing some strings via asp.net in my dbase. The string looks like this:
Well, that`s just a simple level 100 quiz aiming to imprint ""standard random number generators are not really random"" program to those who still lack it. What will produce the following C# snippet? ‘ ....
Now I am reading these values via ASP and need to print them out.
Unfortunaly it does not UnCode the string back so that I can show it to the user. I know I could use the replace function but I wont replace all chars, there are many from this type. What can I do?
I was wondering how do you compare variables that contain text strings in ASP.When I use the following If. Then statement:
If Rs("StyleNo") <> arrStyleNo(aCount) Then
I always get the following error when I try to browse the page:
Error Type:
(0x80020009)
Exception occurred.
I'm trying to see if a certain string matches a predefined string so I've tried:
--------------
If txtCondition3 = "NO THEFT COVER unless client claim free and occupied
prems for 3 yrs" Then
response.write "1st condition"
Else
response.write "2nd condition"
End If
--------------
But I'm getting neither response.
I have a form with multiple text fields, when i submit the form i want it to edit a table in my database using UPDATE. I know i have the syntax correct. The problem I have is 2 fields are Currency and 2 are Date. The request.form command always returns a string and i keep getting the 'Data type mismatch in criteria expression' error. How do i convert the strings to dates, and strings to Currencies.
View Replies View RelatedI am currently developing a registration application for the Boy Scouts. We have paper forms for those who choose not to use a computer to register. The paper forms have a box for each letter so that it is legible. how can i re-create the paper forms with ASP. For those who go online and register they need to print out the youths registration forms and I want them to look like the paper forms.
Now there are a few fields that are mutliple words so it would have to support spaces as well. Is there even a way to do this. I know it is going to be a pain for the good look it is going to be critical. I was thinking of using strings to simply seperate each letter and tell the script to simply repeat until. Is the right way?