triggers

WPF Showing / Hiding a control with triggers

人盡茶涼 提交于 2020-02-01 04:58:20
问题 I'm new to WPF and I trying to create xaml logic to show / hide a control based on the value of the AllowMiscTitle on the ViewModel. The xaml consist of two fields a combobox of the standard tiles ("Mr", "Mrs", ..., "Other") when "Other" is selected I want the textbox to display. I've created the follow xaml: <DockPanel Validation.Error="Validation_Error" HorizontalAlignment="Stretch"> <ComboBox ItemsSource="{Binding Path=Titles, Mode=OneTime}" Text="{Binding Path=Title}"/> <TextBox x:Name=

Adding a constraint to prevent duplicates in SQL Update Trigger

▼魔方 西西 提交于 2020-01-30 09:15:14
问题 We have a user table, every user has an unique email and username. We try to do this within our code but we want to be sure users are never inserted (or updated) in the database with the same username of email. I've added a BEFORE INSERT Trigger which prevents the insertion of duplicate users. CREATE TRIGGER [dbo].[BeforeUpdateUser] ON [dbo].[Users] INSTEAD OF INSERT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON;

Looping in Trigger?

拥有回忆 提交于 2020-01-25 23:46:00
问题 I got this following scenario, There are four tables COUNTRY, STATE, CITY, STREET And I have the excel file with the records of the above..possibly 2000 rows as of now. I used SqlBulkCopy to import the data to a temp table, lets name the table IMPORT. And i wrote one trigger for insert on the IMPORT table which gets the inserted record and splits country, state, city, street then inserts them to the respective table. In this trigger i got to do some conditional check,like, if COUNTRY name is

Looping in Trigger?

情到浓时终转凉″ 提交于 2020-01-25 23:45:03
问题 I got this following scenario, There are four tables COUNTRY, STATE, CITY, STREET And I have the excel file with the records of the above..possibly 2000 rows as of now. I used SqlBulkCopy to import the data to a temp table, lets name the table IMPORT. And i wrote one trigger for insert on the IMPORT table which gets the inserted record and splits country, state, city, street then inserts them to the respective table. In this trigger i got to do some conditional check,like, if COUNTRY name is

MySQL Error: Can't update table 'tbl' in stored function/trigger because it is already used by statement which invoked this stored function/trigger

荒凉一梦 提交于 2020-01-25 15:50:23
问题 Error: Can't update table 'tbl' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. Trigger before insert code: CREATE DEFINER=`root`@`localhost` TRIGGER `opcdls`.`tblTrigger` BEFORE INSERT ON `tbl` FOR EACH ROW BEGIN DELETE FROM tbl WHERE ProxyLoggingDate <= DATE_SUB(NOW(), INTERVAL 7 WEEK); END I want to create a trigger where before each insert check each row and delete the old. But when I try to add a ro on this table it gives me

SQL triggers cause errors

回眸只為那壹抹淺笑 提交于 2020-01-25 10:53:05
问题 Let's create a TestParent table which caches the total value of the num column in a TestChild table, and insert some rows. CREATE TABLE TestParent ( id INT NOT NULL PRIMARY KEY, total INT NOT NULL DEFAULT 0); CREATE TABLE TestChild ( parent_id INT NOT NULL, num INT NOT NULL); INSERT INTO TestParent (id) VALUES (123); INSERT INTO TestChild (parent_id, num) VALUES (123, 1); CREATE PROCEDURE Sync (IN parent INT) UPDATE TestParent SET total = ( SELECT SUM(num) FROM TestChild WHERE parent_id

How to create trigger to run multiple function in parallel (passing parameter)

℡╲_俬逩灬. 提交于 2020-01-25 09:18:06
问题 I Have a function that I would like to run multiple time to reduce the overhaul processing of the function : function ModifyVAxisChartThreading(){ var nbChart=39; i++; for(var j=i;j<nbChart;j+=4) { Vmax=rangeMax[j*6]; Vmin=rangeMinId[j*6]; id=rangeMinId[(j*6)+1]; var delta=(Vmax-Vmin)*0.1; Logger.log("Vmax="+Vmax+"Vmin="+Vmin+"id="+id+"i="+j); var currChart = chart[id]; if(currChart.getType()!="COLUMN") { Vmin-=delta Vmax=Number(Vmax)+(delta*1.5)//Number() function to avoid Vmax becoming a

Access dynamic column name of row type in trigger function

巧了我就是萌 提交于 2020-01-24 21:17:27
问题 I am trying to create a dynamic function to use for setting up triggers. CREATE OR REPLACE FUNCTION device_bid_modifiers_count_per() RETURNS TRIGGER AS $$ DECLARE devices_count INTEGER; table_name regclass := TG_ARGV[0]; column_name VARCHAR := TG_ARGV[1]; BEGIN LOCK TABLE device_types IN EXCLUSIVE MODE; EXECUTE format('LOCK TABLE %s IN EXCLUSIVE MODE', table_name); SELECT INTO devices_count device_types_count(); IF TG_OP = 'DELETE' THEN SELECT format( 'PERFORM validate_bid_modifiers_count(%s,

Oracle : Is it possible to create a Role in a Trigger?

自闭症网瘾萝莉.ら 提交于 2020-01-24 20:31:06
问题 I have a separate table with some data and I would like to a create a new role each time a new row is inserted in that table. I created the following trigger: create or replace TRIGGER TestTrigger BEFORE INSERT ON TestTable REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW BEGIN create role :New.RoleName; END; but the trigger doesn't compile. I have the error: PLS-00103: PLS-00103: Encountered the symbol "CREATE" when expecting one of the following: ( begin case declare exit for goto if loop mod

WPF - ListView Item on Selected change Font size

旧城冷巷雨未停 提交于 2020-01-24 11:24:31
问题 this is my code: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <ListBox ItemsSource="{Binding Persons}"> <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Border Background="White" BorderThickness="5" Name="Bd"> <Border.Style> <Style TargetType=