我在mysql表中有一个日期和状态列。目前的帖子状态是=已发送/已接收。我只想在15天后自动更改状态=中止。任何帮助将受到高度赞赏。
查询:
if (txtrecdate.Text == "" && ddlstatus.SelectedItem.Text != "Completed")
{
queryStr = "update barter_proposals set website_a=?web_a,email_id=?email,email_id2=?email2,email_id3=?email3,contact_name=?cname,proposal_status=?status,reason=?rsn," +
"comment1=?com1 ,agreement=?agreement,agrmt_filename=?agrmt_filename,comment2=?com2,comment3=?com3,lifespan_date=?lpdate where pro_id=?pro_id";
}
我用谷歌搜索并发现了这个解决方案。
UPDATE table SET status = "Aborted" where date=DATE_ADD(date, INTERVAL 15 DAY)
如何在我的更新查询中应用此功能? 有没有其他方法可以在15天后自动更改状态?
答案 0 :(得分:2)
了解MySQL事件。首先,您需要在MySQL端打开事件调度程序
https://dev.mysql.com/doc/refman/5.7/en/events-configuration.html
然后创建活动
<Popup PlacementTarget="{Binding ElementName=ImgHelp}" Placement="Left" VerticalOffset="48"
x:Name="PuHelp" AllowsTransparency="True" IsOpen="True">
<Popup.Tag>
<system:Double>0.0</system:Double>
</Popup.Tag>
<Popup.Width>
<MultiBinding Converter="{StaticResource CvMultiply}">
<Binding Path="ActualWidth" ElementName="GdHelpContent" />
<Binding Path="Tag" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Popup.Width>
<Popup.Height>
<MultiBinding Converter="{StaticResource CvMultiply}">
<Binding Path="ActualHeight" ElementName="GdHelpContent" />
<Binding Path="Tag" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Popup.Height>
<Popup.HorizontalOffset>
<MultiBinding Converter="{StaticResource CvNegate}">
<Binding Path="ActualWidth" ElementName="GdHelpContent" />
<Binding Path="Tag" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Popup.HorizontalOffset>
<Popup.Style>
<Style TargetType="Popup">
<Style.Triggers>
<DataTrigger Binding="{Binding IsHelpOpen, RelativeSource={RelativeSource AncestorType={x:Type local:UC_ApplicationWindow}}}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="0:0:0.25" To="1" Storyboard.TargetProperty="Tag" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="0:0:0.25" To="0" Storyboard.TargetProperty="Tag" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Popup.Style>
<Grid x:Name="GdHelpContent" RenderTransformOrigin="1,1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.RenderTransform>
<TranslateTransform x:Name="tfGrid" X="0" Y="0" />
</Grid.RenderTransform>
<Grid Background="{StaticResource BrApplicationHeader}">
<ContentControl Margin="15" Content="{Binding HelpContent, RelativeSource={RelativeSource AncestorType={x:Type local:UC_ApplicationWindow}}}" />
</Grid>
</Grid>
</Popup>
活动将每天执行一次