Question : Date insert into Access DB switches between MM-DD-YYYY into DD-MM-YYYY

Hi

I have made a page (using Dreamweaver - so no handcoding) that inserts data into an Access DB.

All my date inserts converts from MM-DD-YYYY into DD-MM-YYYY.

Now - I actually want DD-MM-YYYY so that's why I have to insert as MM-DD-YYYY.

If I submit 04-05-2010 I get 05-04-2010.
If I submit 13-05-2010 I get 13-05-2010.

The insert code is below (dreamweaver generated):
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
<%
If (CStr(Request("MM_insert")) = "form1") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd
    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_ConnNews_STRING
    	MM_editCmd.CommandText = "INSERT INTO tblMenu (start_date, end_date, category, navn, link, event_date, course, menu) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 135, 1, -1, DateValue(Request.Form("start_date"))) ' adDBTimeStamp
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 135, 1, -1, DateValue(Request.Form("end_date"))) ' adDBTimeStamp
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 255, Request.Form("category")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202, 1, 255, Request.Form("navn")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202, 1, 255, Request.Form("link")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 135, 1, -1, DateValue(Request.Form("event_date"))) ' adDBTimeStamp
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 202, 1, 255, Request.Form("course")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 203, 1, 536870910, Request.Form("menu")) ' adLongVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "tak.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>


The strangest part is my Access DB looks fine.

When I open up the database from Access dates entered as 04-05-2010 remains as 04-05-2010.

The select code that displays the date is shown:
1:
2:
"SELECT id, course, event_date, timestamp  FROM tblMenu  WHERE category = 'kalender'  AND event_date >= date()-3  ORDER BY event_date asc"

Answer : Date insert into Access DB switches between MM-DD-YYYY into DD-MM-YYYY

hi check the code i attached

even the cast function doesnt work with access,

now the code below i tried and it worked with access
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
<%
Dim RSForside
Dim RSForside_numRows 
Set RSForside = Server.CreateObject("ADODB.Recordset")
RSForside.ActiveConnection = MM_ConnNews_STRING
RSForside.Source = "SELECT DatePart('d',[eventdate]) AS Day ,  DatePart('m',[eventdate]) AS month ,  DatePart('yyyy',[eventdate]) AS Year
FROM tblmenu;"
RSForside.CursorType = 0
RSForside.CursorLocation = 2
RSForside.LockType = 1
RSForside.Open() 
RSForside_numRows = 0
%> 
Random Solutions  
 
programming4us programming4us