Denne side indeholder artikler med forskellige perspektiver på Identity & Access Management i private og offentlige organisationer. Artiklerne behandler aktuelle IAM-emner og leveres af producenter, rådgivere og implementeringspartnere.
The way you display dates is one thing, but the way they are stored is always the same, and I am sure it will be soreted after this. If not there are functions which you can use to extract each part of the date as columns, and you can sort after these.
Det er nu også et dumt format du har valgt! - Husk altid at vælge US ie. yyyymmdd, så har du ingen problemer overhovedet. Jeg ville lave det om med det samme hvis jeg var dig :O)
the databse is datbase the tabel is kalender the colum datofra
and the datoformat for chrismas is 24-12-02 Were are my mistake...
my code ís
Set kalpunkt = Server.CreateObject ("ADODB.Recordset") kalpunkt.open "SELECT DATEPART(yy, datofra) AS Y, DATEPART(m, datofra) AS M, DATEPART(d, datofra) AS D ORDER BY Y, M, D FROM kalender", datbase
Fejltype: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) [Microsoft][ODBC Microsoft Access-driver] SELECT-sætningen indeholder et reserveret ord eller argument, der er stavet forkert eller mangler, eller tegnsætningen er ikke korrekt. /kalender/kalender.asp, line 22
Linie 22 er netop: kalpunkt.open "SELECT DATEPART(yy, datofra) AS Y, DATEPART(m, datofra) AS M, DATEPART(d, datofra) AS D ORDER BY Y, M, D FROM kalender", datbase
Du skal bytte om på order by og from... SELECT DATEPART(yy, datofra) AS Y, DATEPART(m, datofra) AS M, DATEPART(d, datofra) AS D FROM kalender ORDER BY Y, M, D
spejder leon, well its obvious what your problem is now that we see some code!
You have placed your question in MS SQL server BUT you are using an Access driver! Can we please have some more info? IF you are in Access and are selecting from an SQL Server then you use Access SQL syntax unless you are making a passthrough query.
dim Y, MDR, DAY kalpunkt.open "SELECT DATEPART(yy, datofra) AS Year, DATEPART(m, datofra) AS Mdr, DATEPART(d, datofra) AS Day FROM kalender ORDER BY Year, Mdr, Day DESC", datbase
And get the fault Fejltype:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10) [Microsoft][ODBC Microsoft Access-driver] Der er for få parametre. Der var ventet 6. /kalender/kalender.asp, line 17
Fejltype: Der opstod en Microsoft VBScript-kompileringsfejl (0x800A0401) Slut på sætning var ventet /kalender/kalender.asp, line 17, column 32 kalpunkt.open "SELECT DATEPART("yyyy", datofra) AS Y, DATEPART("m", datofra) AS M, DATEPART("d", datofra) AS D FROM kalender ORDER BY Y, M, D DESC" , datbase
kalpunkt.open "SELECT * FROM kalender ORDER BY CDate(datofra) asc",datbase
But I'm a scout and althow good work should make people happy, and that schould be enough payment, it is Christmas, And you fellows have helped and worked... so I will Pay ;-)
Hi scout, no problems with the points. Notice my answer 08/12-2002 14:11:04! This is in my mind the same as what you are doing here. IF your field is a date/time type then CDATE should NOT be necessary. But if say it is a text then it may be necessary althoug hyou may get incorrect results!!!!
EXAMPLE> If its a text field and you have entered in mm/dd/yyyy format then
06/07/2002 is 7th june 2002 But CDate doesnt know that, it thinks its 6th July!!!!
You are right about 06/07/2002 is 7th june 2002. BUT! 6 juli 2003 worked when i testted....
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.