Print Page | Close Window

Information only picked up to the comma

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=23689
Printed Date: 28 March 2026 at 11:06pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Information only picked up to the comma
Posted By: mkbutler
Subject: Information only picked up to the comma
Date Posted: 07 July 2007 at 3:56am
I have a database with a field called StudentName. The name is stored in the database as LastName, FirstName. I cannot change this field as I did not create the database and it is used with other programs. When the StudentName is displayed on the Internet in a Text Box, the field only displays up to the comma. For instance if the StudentName in the db is "Butler, Mona" only "Butler," is displayed on the Internet. What suggestions do you gurus have?



Replies:
Posted By: kbannon
Date Posted: 07 July 2007 at 9:54am
You need to use two functions to get this:

Dim number_of_characters_to_the_comma
Dim myVariable
'find out where in the string the comma occurs
number_of_characters_to_the_comma = Instr(myVariable,",")

'get the left characters to that point
myVariable = Left(myVariable, number_of_characters_to_the_comma)


-------------
I don't suffer from insanity, I enjoy every minute of it.


Posted By: mkbutler
Date Posted: 07 July 2007 at 3:20pm
That would allow me to pull out what occurs prior to the comma. I want the full field to display. For some reason all that is displaying is what is prior to the comma.
The database contains: Butler, Mona
The Internet is displaying: Butler,
I want: Butler, Mona
 
I am using Response.Write (object ("fieldName")). Why does this only show up to the comma?


Posted By: kbannon
Date Posted: 07 July 2007 at 9:18pm
If you are using Response.Write (object ("StudentName")) then it should display the contents of that field - both lastname & comma & firstname.
Are you sure its not being edited somewhere along the way?
How are the records pulled from the database? Could the SQL statement be dropping the firstname part?


-------------
I don't suffer from insanity, I enjoy every minute of it.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net