Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 7th, 2005, 03:55 PM
Registered User
 
Join Date: Jul 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default automatically update or insert record

I was wondering if it is possible to automatically update or insert a record after executing a function by using the dreamweaver mx update record behavior, but without using any server side control (without the user clicking a submit button or any other command). This web page will only request two cookies and insert the value on a table.

I have try different ways but it seems that the values of my hiddenforms that I use to insert the records are deleted before executing the Insertar.Expression.Doinit()

This is what I am doing:

''''''''''This is my insert record behavior code
<MM:Insert
runat="server"
id="insertar"
CommandText='<%# "INSERT INTO dbo.Waist (WaistID, Waist) VALUES (@WaistID, @Waist)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_STRING_TMDatabase") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_DATABASETYPE_TMDatabase") %>'
Expression="false"
CreateDataSet="false"
SuccessURL='<%# "index.htm" %>'
Debug="true"
><Parameters>
  <Parameter Name="@WaistID" Value='<%# IIf((Request.Form("hf_PID") <> Nothing), Request.Form("hf_PID"), "") %>' Type="BigInt" />
  <Parameter Name="@Waist" Value='<%# IIf((Request.Form("hf_PID2") <> Nothing), Request.Form("hf_PID2"), "") %>' Type="Int" />
</Parameters>
</MM:Insert>

'''''This is where I initialize the cookies
<script runat="server">
Public PatientID as HttpCookie
Public waist2 as HttpCookie
Public wasitstring as string

Sub Page_Init(Src As Object, E As EventArgs)
PatientID = request.Cookies("pPatientID")
waist2 = request.Cookies("pWaist")
End Sub
</script>

'''''This is where I assigne the cookies to a hidden form and then call the INSERT behavior to insert the values to the database
<script runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
hf_PID.Value= PatientID.value
hf_PID2.Value = waist2.value

Label1.Text = Cstr(hf_PID.Value) + Cstr(hf_PID2.Value)

insertar.Expression = "true"
insertar.DoInit()
insertar.Expression = "false"

End Sub
</script>


--------------------------------------------------------------------------------


I have also tried to put all the code under the Sub Page_Load(Src As Object, E As EventArgs) or Sub Page_Prerednder(Src As Object, E As EventArgs) functions but nothing happens.

If I use the UPDATE RECORD BEhavior instead of the INSERT RECORD, it will take me to the success page but without updating the hidden forms values on the database.

Do you have any suggestions? DoI need to include something else besides insertar.Expression = "true" ?

Thank you,







Similar Threads
Thread Thread Starter Forum Replies Last Post
automatically update the version of AssemblyInfo piyushnu C# 0 April 14th, 2006 06:17 AM
How to insert row no automatically Jane SQL Server 2000 1 January 13th, 2006 12:20 PM
Automatically update all fields [Word 2003] devstylex Access VBA 2 February 2nd, 2005 08:46 AM
Update Source Record After Insert Duncan Allen SQL Server DTS 1 October 25th, 2004 10:44 AM





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