小编lok*_*oki的帖子

如何在SQL Server中使用select查询创建表?

我尝试使用SYS查询生成50-100个表

SELECT windows_release, windows_service_pack_level, 
       windows_sku, os_language_version
FROM sys.dm_os_windows_info OPTION (RECOMPILE);     -- DE????RSE INSERT ETSIN AYNI ISE DE???MES?N

-- Gives you major OS version, Service Pack, Edition, and language info for the operating system

-- SQL Server Services information (SQL Server 2008 R2 SP1 or greater)
SELECT servicename, startup_type_desc, status_desc, 
last_startup_time, service_account, is_clustered, cluster_nodename
FROM sys.dm_server_services OPTION (RECOMPILE);


-- Hardware information from SQL Server 2008 
-- (Cannot distinguish between HT and multi-core)
SELECT cpu_count AS [Logical CPU Count], hyperthread_ratio AS [Hyperthread …
Run Code Online (Sandbox Code Playgroud)

sql sql-server sql-server-2008

34
推荐指数
3
解决办法
11万
查看次数

如何在实体框架中使用交易?

如何在Entity Framework中使用事务?我在Stackoverflow上阅读了一些链接:使用Transactions或SaveChanges(false)和AcceptAllChanges()?

但; 我有3个表,所以我有3个实体:

CREATE TABLE Personel 
(PersonelID integer PRIMARY KEY identity not null, 
Ad varchar(30), 
Soyad varchar(30),
Meslek varchar(100),
DogumTarihi datetime,
DogumYeri nvarchar(100),
PirimToplam? float);

Go

create TABLE Prim
(PrimID integer PRIMARY KEY identity not null,
PersonelID integer Foreign KEY references Personel(PersonelID),
SatisTutari int,
Prim float,
SatisTarihi Datetime);

Go

CREATE TABLE Finans 
(ID integer PRIMARY KEY identity not null, 
Tutar float);
Run Code Online (Sandbox Code Playgroud)

Personel,Prim,Finans我的桌子.如果你看Prim表你可以看到Prim值浮点值如果我写一个文本框而不是浮点值我的事务必须运行.

using (TestEntities testCtx = new TestEntities())
{
    using (TransactionScope scope = new TransactionScope())
    {
       // do …
Run Code Online (Sandbox Code Playgroud)

.net c# entity-framework visual-studio-2010 visual-studio-2008

10
推荐指数
1
解决办法
9698
查看次数

如何将一个xaml页面导航到另一个页面?

我有2页我需要导航mainpage.xaml到login.page xaml但它抛出我 对象引用未设置为对象的实例.在Root.Children.Clear(); ....

我在App.xaml中添加了这些代码:

   private void Application_Startup(object sender, StartupEventArgs e)
        {
            Grid myGrid = new Grid();
            myGrid.Children.Add(new MainPage());
            this.RootVisual = myGrid;
       }
Run Code Online (Sandbox Code Playgroud)

而且我在main.xaml上添加了一些代码以导航到LoginUI.xaml

namespace Gen.CallCenter.UI
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();

            Grid Root = ((Grid)(this.Parent));
            Root.Children.Clear();
            Root.Children.Add(new LoginUI());
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

如何将main.xaml导航到LoginUI.xaml?

silverlight xaml silverlight-4.0 c#-4.0

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

我何时使用抽象类与接口相关的依赖注入?

我一直在阅读一些关于SOLID原则和依赖Inversion的文章.从我的角度来看,我必须使用一个界面来与任何一个班级交谈.我的课程是通过使用接口聊天.

第一个问题:

我正在使用抽象类,但对于我的代码的第二部分,我使用了一个接口.

Usage1


namespace DependencyInjection
{

    public interface IMessage
    {

    }
    public abstract class Message
    {
        public abstract void Get();
        public abstract void Send();
    }

    public class Sms : Message, IMessage
    {
        public override void Get()
        {
            Console.WriteLine("Message Get!");
        }
        public override void Send()
        {
            Console.WriteLine("Message Send!");
        }
    }

    public class MessageManager
    {
        private IMessage _message;

        public Sms Sms
        {
            get { return _message as Sms; }
            set { _message = value; }
        }

        public MessageManager(IMessage message)
        {
            _message …
Run Code Online (Sandbox Code Playgroud)

.net c# oop design-patterns

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

为什么我使用UpdateSourceTrigger = PropertyChanged,TwoWay还不够?

喜; 有源文件框和目标文本框txttarget有一个绑定到txtsource.当在txtsource中写一些东西时,txttarget就会改变.一切都很好.但是在txttarget上写道,我在txttarget上看不到任何变化?有TwoWay模式.Twoway模式还不够?我可以在不使用"UpdateSourceTrigger = PropertyChanged"的情况下编写吗?


   <Grid>
        <TextBox Height="23" HorizontalAlignment="Left" Margin="155,62,0,0" Name="txtSource" VerticalAlignment="Top" Width="120" />
        <TextBox Height="23" HorizontalAlignment="Left"
                 Text="{Binding ElementName=txtSource,Path=Text,Mode=TwoWay}" 
                 Margin="155,113,0,0" Name="txtTarget" VerticalAlignment="Top" Width="120" />
    </Grid>
Run Code Online (Sandbox Code Playgroud)

.net c# wpf xaml propertychanged

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

如何使用DotNumerics解决线性编程问题?

我对数值分析很感兴趣.我一直在使用DotNumerics开源应用程序.我的线性系统如下:

1 * x + 3 * y <= 150
2 * x + 1 * y <= 100
Run Code Online (Sandbox Code Playgroud)

哪里 x >= 0, y >= 0

z = 10 * x + 15 * y
Run Code Online (Sandbox Code Playgroud)

我想解决z(优化......)

我可以使用Simplex方法来解决此链接中的上述问题.我也通过电子邮件发送了作者,但他没有回复.

using DotNumerics.Optimization;
using DotNumerics;

namespace App.SimplexCalcLinearProgramming
{
    class Program
    {
        static void Main(string[] args)
        {
            Simplex simplex = new Simplex();
            double[] initialGuess = new double[2];
            initialGuess[0] = 0.1;
            initialGuess[1] = 2;
            double[] minimum = simplex.ComputeMin(AmacFunction, initialGuess);
            minimum.ToList().ForEach(q => Console.Write(q.ToString() + …
Run Code Online (Sandbox Code Playgroud)

.net c# numerical-methods

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

AppDomain.CreateInstance和Activator.CreateInstance有什么区别?

我想问一个问题来实现AppDomain和Activator之间的区别,我通过appdomain.CreateInstance加载了我的dll.但我意识到创建实例的方法更多.因此,何时或何地选择此方法?例1:

    // Use the file name to load the assembly into the current
    // application domain.
    Assembly a = Assembly.Load("example");
    // Get the type to use.
    Type myType = a.GetType("Example");
    // Get the method to call.
    MethodInfo myMethod = myType.GetMethod("MethodA");
    // Create an instance.
    object obj = Activator.CreateInstance(myType);
    // Execute the method.
    myMethod.Invoke(obj, null);
Run Code Online (Sandbox Code Playgroud)

例2:

public WsdlClassParser CreateWsdlClassParser()
{
    this.CreateAppDomain(null);

    string AssemblyPath = Assembly.GetExecutingAssembly().Location; 
    WsdlClassParser parser = null;
    try
    {                
        parser = (WsdlClassParser) this.LocalAppDomain.CreateInstanceFrom(AssemblyPath,
                                          typeof(Westwind.WebServices.WsdlClassParser).FullName).Unwrap() ;                
    }
    catch (Exception ex) …
Run Code Online (Sandbox Code Playgroud)

.net c# appdomain activator

6
推荐指数
1
解决办法
3821
查看次数

如何创建SQL Server加载项?

我尝试像这样开发SQL Server Management Studio的加载项:

http://aspalliance.com/1374_Extend_Functionality_in_SQL_Server_2005_Management_Studio_with_Addins.all

但是:我在谷歌搜索了SSMS加载项.我找到了一个很好的链接,但我今天找不到它:(可能是你可以给一些最好的建议和链接:(

有些作者说

事情可能会随SQL 2008而改变,或者可能保持不变.程序集可能会稍微改变一下,Microsoft会为加载项提供一些支持.有各种日常任务,您可以自动化或提供更好的方式,然后由SSMS提供.您只需要可视化您的工具并继续寻找编码和实现它的方法.

sql-server ssms sql-server-2008 ssms-addin

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

如何学习Enterprise Library 4.0?

我正在尝试学习企业库.我找到了这个有用的代码示例来从SQL数据库中获取数据.但我试图通过参数发送数据.我也在使用UPDATE,DELETE和SAVE方法.你能给我一个类似的样品吗?我正在使用Enterprise Library 4.0.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Microsoft.Practices.EnterpriseLibrary.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace WebApplicationForEnterpirires
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Database objdbase = DatabaseFactory.CreateDatabase("connectionString");
            DataSet ds = objdbase.ExecuteDataSet(CommandType.StoredProcedure, "sp_GetProducts");
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net enterprise-library

4
推荐指数
1
解决办法
2621
查看次数

如何在ASP.NET中使用插件架构?

我非常喜欢WinForms的插件架构,我想在Asp.net中使用插件架构.

我在asp.net中搜索了插件架构,我发现了asp.net MVC示例,但我想使用经典的asp.net项目而不是MVC.

有没有人知道使用经典asp.net的模式的任何资源,而不是MVC?

.net c# asp.net visual-studio

4
推荐指数
1
解决办法
6501
查看次数