可以设置一个Icon,以便在当前应用程序的每个窗口中使用它.所以我设置了一次(不是手动每个窗口)..?
我有启用Service Broker的DataBase.然后我想在程序中从其他数据库的备份恢复我的数据库,但在恢复(我恢复现有数据库名称)后,我的方法,whitch启用Service Broker,放置此错误:
Msg 9772, Level 16, State 1, Line 1
The Service Broker in database "ServeDB2" cannot be enabled because there is already an enabled Service Broker with the same ID.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
Run Code Online (Sandbox Code Playgroud)
这是我的方法:
public void TurnOnBroker()
{
if (!this.database.BrokerEnabled)
{
this.server.KillAllProcesses(this.database.Name);
this.database.BrokerEnabled = true;
this.database.Alter();
RefreshConnection();
}
}
Run Code Online (Sandbox Code Playgroud)
我应该在这里解决什么?有什么建议吗?
我无法确定如何使用鼠标滚轮水平滚动.垂直滚动可以自动运行,但我需要水平滚动我的内容.我的代码看起来像这样:
<ListBox x:Name="receiptList"
Margin="5,0"
Grid.Row="1"
ItemTemplate="{StaticResource receiptListItemDataTemplate}"
ItemsSource="{Binding OpenReceipts}"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"
ScrollViewer.HorizontalScrollBarVisibility="Visible"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
我的项目模板如下所示:
<DataTemplate x:Key="receiptListItemDataTemplate">
<RadioButton GroupName="Numbers"
Command="{Binding Path=DataContext.SelectReceiptCommand,RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type POS:PointOfSaleControl}}}"
CommandParameter="{Binding }"
Margin="2,0"
IsChecked="{Binding IsSelected}">
<RadioButton.Template>
<ControlTemplate TargetType="{x:Type RadioButton}" >
<Grid x:Name="receiptGrid" >
<Grid>
<Border BorderThickness="2"
BorderBrush="Green"
Height="20"
Width="20">
<Grid x:Name="radioButtonGrid"
Background="DarkOrange">
<TextBlock x:Name="receiptLabel"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Path=NumberInQueue, Mode=OneWay}"
FontWeight="Bold"
FontSize="12"
Foreground="White">
</TextBlock>
</Grid>
</Border>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Margin"
TargetName="receiptGrid"
Value="2,2,-1,-1"/>
<Setter Property="Background"
TargetName="radioButtonGrid"
Value="Maroon"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</RadioButton.Template> …
Run Code Online (Sandbox Code Playgroud) 我在C#Windows应用程序中有一些tabControl.它有一些tabPages.有没有人知道如何使tabPage Text成为Bold ..?
我想要cach输入,这似乎像SQL注入.所以我写了这个方法:
public static bool IsInjection(string inputText)
{
bool isInj = false;
string regexForTypicalInj = @"/\w*((\%27)|(\'))((\%6F)|o|(\%4F))((\%72)|r|(\%52))/ix";
Regex reT = new Regex(regexForTypicalInj);
if (reT.IsMatch(inputText))
isInj = true;
string regexForUnion = @"/((\%27)|(\'))union/ix";
Regex reUn = new Regex(regexForUnion);
if (reUn.IsMatch(inputText))
isInj = true;
string regexForSelect = @"/((\%27)|(\'))select/ix";
Regex reS = new Regex(regexForSelect);
if (reS.IsMatch(inputText))
isInj = true;
string regexForInsert = @"/((\%27)|(\'))insert/ix";
Regex reI = new Regex(regexForInsert);
if (reI.IsMatch(inputText))
isInj = true;
string regexForUpdate = @"/((\%27)|(\'))update/ix";
Regex reU = new Regex(regexForUpdate);
if (reU.IsMatch(inputText))
isInj = …
Run Code Online (Sandbox Code Playgroud) 我有一些用户控制,我想为最终用户禁用Alt+ F4oportunity.当我的用户控件显示时,有机会用Alt+ 关闭它F4,然后程序转到方法中的基类:
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
//Content = null; // Remove child from logical parent - for reusing purposes
this.RemoveLogicalChild(Content); //this works faster
base.OnClosing(e);
{ GC.Collect(); };
}
Run Code Online (Sandbox Code Playgroud)
我必须在这里或其他地方做什么,禁止我的用户控制关闭Alt+ F4?
当我尝试查看我的数据库的属性时,我收到此错误:
属性大小不适用于数据库[数据库名称]此属性可能不存在此属性,或者由于访问权限不足而无法检索(Microsoft.smo ..)
有什么方法可以解决这个问题吗?
我有一些正则表达式,它看起来像这样:
string regexForDrop = @"^((%27)|'|(\-\-))\s*(d|%64|%44)(r|%72|%52)(o|%6F|%4F)(p|%70|%50)$";
Run Code Online (Sandbox Code Playgroud)
它工作正常,当我写入输入" - drop",但它不起作用,当我写"drop table users"或类似的东西.无论" - drop"之后出现什么,我都需要它能够工作.我该如何实现呢?
谢谢
c# ×4
wpf ×4
sql-server ×3
regex ×2
window ×2
winforms ×2
.net ×1
icons ×1
scrollviewer ×1
tabcontrol ×1