Answered
Dynamic List Formatting
I have a list of around 1800 dates (some are duplicates)
stored in an access query. I want to include them in a dynamic list
in date order in the format day month year. - "17/01/2000" without
duplicates - hence the DISTINCT in the recordset below:
<%
var recordset2_cmd = Server.CreateObject ("ADODB.Command");
recordset2_cmd.ActiveConnection = MM_SEEALL_STRING;
recordset2_cmd.CommandText = "SELECT DISTINCT photodate FROM Dates ORDER BY photodate DESC";
recordset2_cmd.Prepared = true;
var recordset2 = recordset2_cmd.Execute();
var recordset2_numRows = 0;
%>
With the following selection code:
<select name="select" size="20" title="<%= DoDateTime((recordset2.Fields.Item("photodate").Value), 2, 2057) %>">
<%
while (!recordset2.EOF) {
%><option value="<%=(recordset2.Fields.Item("photodate").Value)%>" <%=((recordset2.Fields.Item("photodate").Value == (recordset2.Fields.Item("photodate").Value))?"selected=\"selected\"":"")%> ><%=(recordset2.Fields.Item("photodate").Value)%></option>
<%
recordset2.MoveNext();
}
if (recordset2.CursorType > 0) {
if (!recordset2.BOF) recordset2.MoveFirst();
} else {
recordset2.Requery();
}
%>
</select>
When run (on my testing server) the dates (correctly ordered and distinct) are all shown in the form "1/17/2000" instead of 17/01/2000.
Can anyone tell me why?
Howard Walker
<%
var recordset2_cmd = Server.CreateObject ("ADODB.Command");
recordset2_cmd.ActiveConnection = MM_SEEALL_STRING;
recordset2_cmd.CommandText = "SELECT DISTINCT photodate FROM Dates ORDER BY photodate DESC";
recordset2_cmd.Prepared = true;
var recordset2 = recordset2_cmd.Execute();
var recordset2_numRows = 0;
%>
With the following selection code:
<select name="select" size="20" title="<%= DoDateTime((recordset2.Fields.Item("photodate").Value), 2, 2057) %>">
<%
while (!recordset2.EOF) {
%><option value="<%=(recordset2.Fields.Item("photodate").Value)%>" <%=((recordset2.Fields.Item("photodate").Value == (recordset2.Fields.Item("photodate").Value))?"selected=\"selected\"":"")%> ><%=(recordset2.Fields.Item("photodate").Value)%></option>
<%
recordset2.MoveNext();
}
if (recordset2.CursorType > 0) {
if (!recordset2.BOF) recordset2.MoveFirst();
} else {
recordset2.Requery();
}
%>
</select>
When run (on my testing server) the dates (correctly ordered and distinct) are all shown in the form "1/17/2000" instead of 17/01/2000.
Can anyone tell me why?
Howard Walker
