Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Dreamweaver (all versions)
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 7th, 2004, 09:59 AM
Registered User
 
Join Date: Jun 2003
Location: , London, United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Date trouble using Dreamweaver Update

I am having a peculiar proble when using the record update form in dreamweaver 4. The problem is particularly with updating/inserting dates in my sql database. If I enter a UK date in the form I get an error:

Error Type:
(0x80040E07)
/penta_test/editpref.asp, line 132

However, if I enter the date in US format it accepts it but then when I retrieve the updated information it is in UK format. I am thinking that the option will be to convert the entered information to US date before it is processed but can't see how I can do that.

I have set system locale to UK on the SQL server.

Here's a piece of the code:

<%
' *** Update Record: set variables

If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then

  MM_editConnection = MM_fundraising_STRING
  MM_editTable = "dbo.OrgPref"
  MM_editColumn = "OrgPrefID"
  MM_recordId = "" + Request.Form("MM_recordId") + ""
  MM_editRedirectUrl = "donordetails.asp"
  MM_fieldsStr = "GrantSize|value|Programmes|value|AppComments|valu e|AppDate1|value|AppDate2|value|AppMade|value|Outc ome1|value|Outcome2|value|Individuals|value|Buildi ngs|value|Capital|value|Revenue|value|CoreCosts|va lue|Allocated|value"
  MM_columnsStr = "GrantSize|',none,''|Programmes|',none,''|AppComme nts|',none,''|AppDate1|',none,NULL|AppDate2|',none ,NULL|AppMade|',none,''|Outcome1|',none,''|Outcome 2|',none,''|Individuals|',none,''|Buildings|',none ,''|Capital|',none,''|Revenue|',none,''|CoreCosts| ',none,''|Allocated|',none,''"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")

  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next

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

End If
%>
<%
' *** Update Record: construct a sql update statement and execute it

If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  ' create the sql update statement
  MM_editQuery = "update " & MM_editTable & " set "
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_editQuery = MM_editQuery & ","
    End If
    MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
  Next
  MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

  If (Not MM_abortEdit) Then
    ' execute the update
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>

Thanks for any help.

Reply With Quote
  #2 (permalink)  
Old January 7th, 2004, 11:59 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

What you could do is convert the date to this format:

YYYYMMDD, so for example, 20040101

This date will always be interpreted correctly by the database.

You can use Dreamweaver's built-in Date conversions to convert a date to a specific format. Double click your "Dynamic Text" entries on the Server Behaviors panel to select a format.

Cheers,

Imar

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #3 (permalink)  
Old January 8th, 2004, 09:06 AM
Registered User
 
Join Date: Jun 2003
Location: , London, United Kingdom.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Worked a treat, thank you.

The earth has music for those who listen!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
trouble updating pages to server using dreamweaver ramona72 Dreamweaver (all versions) 2 August 21st, 2006 11:55 AM
trouble with Dreamweaver templates rhillman Dreamweaver (all versions) 1 November 30th, 2004 02:56 PM
Dreamweaver MX 2004 7.0.1 update scott_fegette Dreamweaver (all versions) 0 March 12th, 2004 05:01 PM



All times are GMT -4. The time now is 05:54 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.