Forums
 This topic is locked 
             Convert database number to text
 Posted 09 Jul 2003  14:23:15 
  1 
     has   voted 
  09 Jul 2003  14:23:15 Jamie Ellwood posted: 
 Hi,I have a database with a column which I have a number to represent some text (this is to keep the database small). Eg. 1 = "Monday", 2 = "Tuesday" etc. When the database is displayed in the browser, how can I display Monday, Tuesday etc instead of 1,2 etc.
Thanks in advance for any advice.
Jamie
Replies
 Replied 14 Jul 2003  14:58:59 
   14 Jul 2003  14:58:59 Vince Baker replied: 
  add this code where you want to display the Date and replace the name of your fields and recordsets where required.
<%
Select Case yourrecordsetname("fieldname"
Case 1
Response.write("Monday"
Case 2
Response.write("Tuesday"
Case 3
Response.write("Wednesday"
Case 4
Response.write("Thursday"
Case 5
Response.write("Friday"
Case 6
Response.write("Saturday"
Case 7
Response.write("Sunday"
End select
%>
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
  <%
Select Case yourrecordsetname("fieldname"
Case 1
Response.write("Monday"
Case 2
Response.write("Tuesday"
Case 3
Response.write("Wednesday"
Case 4
Response.write("Thursday"
Case 5
Response.write("Friday"
Case 6
Response.write("Saturday"
Case 7
Response.write("Sunday"
End select
%>
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
 Replied 15 Jul 2003  11:29:41 
   15 Jul 2003  11:29:41 Andrew Watson replied: 
  or maybe...
<pre id=code><font face=courier size=2 id=code>
<%= WeekdayName(varDay,,2)
%>
</font id=code></pre id=code>
varDay will be your numeric value...
Edited by - leed on 15 Jul 2003 11:31:53
  <pre id=code><font face=courier size=2 id=code>
<%= WeekdayName(varDay,,2)
%>
</font id=code></pre id=code>
varDay will be your numeric value...
Edited by - leed on 15 Jul 2003 11:31:53
 Replied 15 Jul 2003  15:56:56 
   15 Jul 2003  15:56:56 Vince Baker replied: 
  hmmm...one of the two solutions you have looks a tad tidier than the other.....(go with leed!)
Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
  Regards
Vince
Visit my home: www.chez-vince.com
VBScript | ASP | HTML | SQL | Oracle | Hosting
 Replied 15 Jul 2003  16:05:08 
   15 Jul 2003  16:05:08 Jamie Ellwood replied: 
  Hi leed,
Please can you expand on your solution. I am not too sure how this would be implemented.
  Please can you expand on your solution. I am not too sure how this would be implemented.
