Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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:57 PM
Registered User
 
Join Date: Jul 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default update record behavior without server control

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
Update one record jemacc SQL Server 2000 0 September 12th, 2007 11:47 AM
Login Control Behavior when pressing ENTER rsearing ASP.NET 2.0 Basics 6 July 22nd, 2007 08:21 PM
not update all record mohiddin52 Access VBA 10 May 9th, 2007 11:41 AM
Login Control behavior wirerider ASP.NET 2.0 Professional 0 October 3rd, 2006 05:14 PM
cannot update record keyvanjan ASP.NET 1.0 and 1.1 Basics 0 September 9th, 2006 05:25 AM





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