我是触发器的新手,想要在更新列时创建触发器并使用该值更新另一个表.
我有一个带有年份列的table1,如果应用程序更新该年份列,我需要在同一年更新表2.
ALTER TRIGGER [dbo].[trig_UpdateAnnualYear]
ON [dbo].[table1]
AFTER UPDATE
AS
if (UPDATE (intAnnualYear))
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for trigger here
Update table2 set AnnualYear = intAnnualYear where table2.ID = table1.ID
END
Run Code Online (Sandbox Code Playgroud) 如何从asp.net按钮单击事件中调用showDialog.我的页面是一个内容页面,其中包含与之关联的母版页.
我尝试了以下内容
<asp:Button ID="ButtonAdd" runat="server" Text="Add"
OnClientClick="showDialog('#addPerson');" />
<asp:Button ID="ButtonAdd" runat="server" Text="Add"
OnClientClick="showDialog(#<%=addPerson.ClientID %>);" />
Run Code Online (Sandbox Code Playgroud)
我还必须从gridview模板按钮调用此相同的函数来修改对话框中的记录.
<script type="text/javascript">
// Used the following example to open the dialog withJquery
var dl;
$(document).ready(function () {
//Adding the event of opening the dialog from the asp.net add button.
//setup edit person dialog
$('#addPerson').dialog({
//Setting up the dialog properties.
show: "blind",
hide: "fold",
resizable: false,
modal: true,
height: 400,
width: 700,
title: "Add New Member",
open: function (type, data) {
$(this).parent().appendTo("form:first");
}
});
//setup …Run Code Online (Sandbox Code Playgroud)