小编Vir*_*rus的帖子

SQL中的逗号分隔列表

如何在SQL中循环逗号分隔列表?我有一个ID列表,我需要将这些ID传递给存储过程.我不能改变存储过程.我需要弄清楚如何为每个id执行SP.给我一些想法,我可以从那里继续.

谢谢.

sql sql-server sql-server-2008

29
推荐指数
1
解决办法
3万
查看次数

继承自C#中的两个类

可能重复:
C#中的多重继承

我有两个类A类和B类.这两个类不能相互继承.我正在创建一个名为Class C的新类.现在,我希望通过继承来实现A类和B类中的方法.我知道在C#中不可能有多重继承,但有没有其他方法可以做到这一点?

谢谢

.net c#

12
推荐指数
5
解决办法
11万
查看次数

通过wpf中的属性绑定图像源

我正在尝试使用图像源(.jpg)显示图标.我在视图模型中创建了一个Icon属性,并尝试为其指定图像的路径,但我在视图中看不到任何图像.我尝试将路径转换为位图图像但不起作用.这里有什么我想念的吗?

<StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Path=Name}"/>
                                <Image Source="{Binding Path=Icon}"></Image>
                            </StackPanel>




BitmapImage img = new BitmapImage();
                    img.BeginInit();
                    img.CacheOption = BitmapCacheOption.OnLoad;
                    img.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
                    img.UriSource = new Uri("C:\\Users\\Public\\Pictures\\Sample Pictures\\Chrysanthemum.jpg", UriKind.Absolute);
                    img.EndInit();
                    Icon = img;
Run Code Online (Sandbox Code Playgroud)

wpf xaml

7
推荐指数
1
解决办法
5万
查看次数

在c#中使用WINAPI单击消息框的"确定"按钮

我试图使用winapi单击C#窗体的消息框上的"确定"按钮.以下是我正在处理的代码.

private const int WM_CLOSE = 16;
private const int BN_CLICKED = 245;

[DllImport("user32.dll", CharSet=CharSet.Auto)]
        public static extern int SendMessage(int hWnd, int msg, int wParam, IntPtr lParam);

[DllImport("user32.dll", SetLastError = true)]
        public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className,  string  windowTitle);

//this works
hwnd = FindWindow(null, "Message");
if(hwnd!=0)
      SendMessage(hwnd, WM_CLOSE, 0, IntPtr.Zero);

//this doesn't work.
hwndChild = FindWindowEx((IntPtr)hwnd, IntPtr.Zero, "Button", "ok");
SendMessage((int)hwndChild, BN_CLICKED, 0, IntPtr.Zero);
Run Code Online (Sandbox Code Playgroud)

虽然我得到了一个价值hwndChild,但它没有认识到BN_CLICKED.我不确定我错过了什么.任何帮助?

我试图关闭另一个应用程序的消息框按钮,这就是我正在做的事情.但是,我仍然缺少一些东西.

IntPtr hwndChild = IntPtr.Zero;
hwndChild = FindWindowEx((IntPtr)hwnd, …
Run Code Online (Sandbox Code Playgroud)

c# winapi messagebox

5
推荐指数
2
解决办法
2万
查看次数

使用反射从dll调用方法后获取返回值

我正在使用反射加载一个DLL并试图调用一个返回一个的方法List<customType>.如何调用方法并获取返回值.我试过这个,但是说entry point not found exception.

MethodInfo[] info= classType.GetMethods();
MethodInfo method = mInfo.FirstOrDefault(c => c.Name == "GetDetails");
object values = method.Invoke(classInstance, new object[] { param1});
Run Code Online (Sandbox Code Playgroud)

值有例外entry point not found.

c# reflection

5
推荐指数
1
解决办法
8565
查看次数

使用 espresso 的 Android 自动化,无需应用源代码

在没有源代码的情况下,是否无法使用 espresso 自动化 android 应用程序。Gradle 期望这样的结构:

src/main/
src/androidTest/
Run Code Online (Sandbox Code Playgroud)

但我想在不同版本的应用程序上运行这些自动化测试?这是否可以仅通过安装应用程序并运行测试来实现?

这里说它不可能:

使用 Espresso 自动化 Android APK

automation android gradle android-testing android-espresso

5
推荐指数
2
解决办法
4048
查看次数

sql中变量的数据类型大小

如何在sql中找出数据类型的大小.例如,如果我已将变量或列声明为

declare @test varchar(255)
Run Code Online (Sandbox Code Playgroud)

然后我需要将变量数据类型@test的大小显示为255.

编辑:现在,我知道如何获取列,是否有任何变量的方法?

sql t-sql sql-server sql-server-2008

3
推荐指数
1
解决办法
3627
查看次数

TargetName无法识别

我试图启用和禁用Button基于a 的选择ListBox.如果选择了某个值,则应启用该按钮.
我试图使用触发器,但它给了我一个错误

'targetname not recognized'.

<UserControl x:Class="Qualification.View.QualificationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             Height="500" Width="500">
    <Grid>
        <Button Name="btnOpen"  Command="Open" CommandParameter="{Binding ElementName=lstName, Path=SelectedValue}"  Height="23" Width="100" Margin="259,325,141,152">Add Qualification</Button>
        <Grid.CommandBindings x:Uid="key">
            <CommandBinding Command="Open" CanExecute="CommandBinding_CanExecute" Executed="CommandBinding_Executed"/>
        </Grid.CommandBindings>
        <Grid.Resources>
            <Style TargetType="{x:Type TextBox}">
                <Style.Triggers>
                    <Trigger Property="Validation.HasError" Value="true">
                        <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self},
                               Path=(Validation.Errors)[0].ErrorContent}"/>
                    </Trigger>
                </Style.Triggers>                
            </Style>
            <DataTemplate x:Key="eble">
                <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding Path=IsSelected,RelativeSource={RelativeSource TemplatedParent}}" Value="True">
                        <Setter TargetName="btnOpen" Property="IsEnabled" Value="False"/>
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>
        </Grid.Resources>
        <Label Height="23" Width="100" Margin="17,35,383,442" RenderTransformOrigin="0.48,-3.217">Search</Label>
        <TextBox Name="txtSearch" Text="{Binding Qm.Search, ValidatesOnDataErrors=True, …
Run Code Online (Sandbox Code Playgroud)

wpf xaml triggers

3
推荐指数
1
解决办法
9673
查看次数

方法'Given'的重载没有4个参数-Specflow

我已经安装了specflow。默认情况下,我得到这种情况下要加上两个数字。构建解决方案时,出现这些错误。“方法'Given'的重载不接受4个参数”。我在这里想念什么?这是生成的文件。

public virtual void AddTwoNumbers()
        {
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Add two numbers", new string[] {
                        "mytag"});
            #line 7
            this.ScenarioSetup(scenarioInfo);
            #line 8
             testRunner.Given("I have entered 50 into the calculator", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
            #line 9
             testRunner.And("I have entered 70 into the calculator", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
            #line 10
             testRunner.When("I press add", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
            #line 11
             testRunner.Then("the result should be 120 on the screen", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
            #line hidden

            this.ScenarioCleanup();
        }
Run Code Online (Sandbox Code Playgroud)

对于这种情况:

功能:SpecFlowFeature1为避免愚蠢的错误作为数学白痴,我想被告知两个数字的总和

@mytag方案:将两个数字相加,因为我已经在计算器中输入了50,并且已经在计算器中输入了70。

specflow nuget

3
推荐指数
1
解决办法
2442
查看次数