电脑技术学习

DreamwaverMX与ASP.NET(十九)

dn001
通过modify.aspx页面就可以修改现有数据,并可以通过表单提交事件来更新数据。

其更新的主要代码如下:

< MM:Update

runat="server"

CommandText='< %# "UPDATE LOCATIONS SET CITY=?, STATE_COUNTRY=?, FAX=?, TELEPHONE=?, ADDRESS=? WHERE CODE=?" % >'

ConnectionString='< %# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_location") % >'

DatabaseType='< %# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_location") % >'

Expression='< %# Request.Form("MM_update") = "form1" % >'

CreateDataSet="false"

SuccessURL='< %# "location3.aspx" % >'

Debug="true"

>

< Parameters >

< Parameter Name="@CITY" Value='< %# IIf((Request.Form("city") < > Nothing), Request.Form("city"), "") % >' Type="WChar" / >

< Parameter Name="@STATE_COUNTRY" Value='< %# IIf((Request.Form("state") < > Nothing), Request.Form("state"), "") % >' Type="WChar" / >

< Parameter Name="@FAX" Value='< %# IIf((Request.Form("fax") < > Nothing), Request.Form("fax"), "") % >' Type="WChar" / >

< Parameter Name="@TELEPHONE" Value='< %# IIf((Request.Form("tele") < > Nothing), Request.Form("tele"), "") % >' Type="WChar" / >

< Parameter Name="@ADDRESS" Value='< %# IIf((Request.Form("address") < > Nothing), Request.Form("address"), "") % >' Type="WChar" / >

< Parameter Name="@CODE" Value='< %# IIf((Request.Form("hiddenFIEld") < > Nothing), Request.Form("hiddenField"), "") % >' Type="WChar" / >

< /Parameters >

< /MM:Update >

Dreamweaver MX是通过mm:update来表识更新的代码的。其格式和MM:Insert类似。