Question
INSERT & UPDATE changing date format to mm/dd/yyyy!!!
I have INSERT & UPDATE ASP/VB forms which have a date
field which submits to
Access....except when the date is entered as dd/mm/yyyy, it decides to
convert it to mm/dd/yyyy....absolutely terrific!! :o((
I've added this:
<% Session.LCID = 2057 %>
I've checked the date format, I've done absolutely everything I can think
of, and can source on the newsgroups, but NOTHING.
What, on earth, is going on??????????????
If anyone can help save me from this madness, please tell me why this is
happening?
I'm using ASP/VB, with Access on a Windows server and, up until now, I've
never had this problem.
Here's my INSERT code:
<%@LANGUAGE="VBSCRIPT"%>
<% Session.LCID = 2057 %>
<!--#include file="../Connections/dsnNAME.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" &
Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
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_dsnNAME_STRING
MM_editCmd.CommandText = "INSERT INTO tblNews (newstitle, newsdate,
newsenddate, thumbnail, largeimage, newstextsnip, newstext, emailcontact,
urllink, [include]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202,
1, 75, Request.Form("newstitle")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 135,
1, -1, MM_IIF(Request.Form("newsdate"), Request.Form("newsdate"), null)) '
adDBTimeStamp
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 135,
1, -1, MM_IIF(Request.Form("newsenddate"), Request.Form("newsenddate"),
null)) ' adDBTimeStamp
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202,
1, 75, Request.Form("thumbnail")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202,
1, 75, Request.Form("largeimage")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 203,
1, 536870910, Request.Form("newstextsnip")) ' adLongVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 203,
1, 536870910, Request.Form("newstext")) ' adLongVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 202,
1, 75, Request.Form("emailcontact")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 202,
1, 75, Request.Form("urllink")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 5,
1, -1, MM_IIF(Request.Form("include"), 1, 0)) ' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "confirm.htm"
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
%>
Thanks.
Nath.
Access....except when the date is entered as dd/mm/yyyy, it decides to
convert it to mm/dd/yyyy....absolutely terrific!! :o((
I've added this:
<% Session.LCID = 2057 %>
I've checked the date format, I've done absolutely everything I can think
of, and can source on the newsgroups, but NOTHING.
What, on earth, is going on??????????????
If anyone can help save me from this madness, please tell me why this is
happening?
I'm using ASP/VB, with Access on a Windows server and, up until now, I've
never had this problem.
Here's my INSERT code:
<%@LANGUAGE="VBSCRIPT"%>
<% Session.LCID = 2057 %>
<!--#include file="../Connections/dsnNAME.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" &
Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%>
<%
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_dsnNAME_STRING
MM_editCmd.CommandText = "INSERT INTO tblNews (newstitle, newsdate,
newsenddate, thumbnail, largeimage, newstextsnip, newstext, emailcontact,
urllink, [include]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202,
1, 75, Request.Form("newstitle")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 135,
1, -1, MM_IIF(Request.Form("newsdate"), Request.Form("newsdate"), null)) '
adDBTimeStamp
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 135,
1, -1, MM_IIF(Request.Form("newsenddate"), Request.Form("newsenddate"),
null)) ' adDBTimeStamp
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 202,
1, 75, Request.Form("thumbnail")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 202,
1, 75, Request.Form("largeimage")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param6", 203,
1, 536870910, Request.Form("newstextsnip")) ' adLongVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param7", 203,
1, 536870910, Request.Form("newstext")) ' adLongVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param8", 202,
1, 75, Request.Form("emailcontact")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param9", 202,
1, 75, Request.Form("urllink")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param10", 5,
1, -1, MM_IIF(Request.Form("include"), 1, 0)) ' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
' append the query string to the redirect URL
Dim MM_editRedirectUrl
MM_editRedirectUrl = "confirm.htm"
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
%>
Thanks.
Nath.