小编JSJ*_*JSJ的帖子

SQL Server未记录的存储过程和函数

大家好,我发现SQL Server中有许多高级特色存储过程,这些都没有在线书籍记录.我通过谷歌搜索发现了它们.以下是其中一些如果您有其他人请与我分享.

SQL Server中未记录的存储过程

sp_checknames
sp_columns_rowset
sp_enumoledbdatasources
sp_fixindex
sp_gettypestring
sp_ms_marksystemobject
sp_msaddguidcolumn
sp_msaddguidindex
sp_msaddlogin_implicit_ntlogin
sp_msadduser_implicit_ntlogin
sp_mscheck_uid_owns_anything
sp_msdbuseraccess
sp_msdbuserpriv
sp_msdependencies
sp_msdrop_object
sp_msforeachdb
sp_msforeachtable
sp_msget_qualified_name
sp_msgettools_path
sp_msgetversion
sp_msguidtostr
sp_mshelpcolumns
sp_mshelpindex
sp_mshelptype
sp_msindexspace
sp_msis_pk_col
sp_mskilldb
sp_msloginmappings
sp_mstablekeys
sp_mstablerefs
sp_mstablespace
sp_msunc_to_drive
sp_msuniquecolname
sp_msuniquename
sp_msuniqueobjectname
sp_msuniquetempname
sp_tempdbspace
sp_who2
xp_delete_file
xp_dirtree
xp_enum_oledb_providers
xp_enumcodepages
xp_enumdsn
xp_enumerrorlogs
xp_enumgroups
xp_fileexist
xp_fixeddrives
xp_get_mapi_default_profile
xp_get_mapi_profiles
xp_getnetname
xp_qv
xp_readerrorlog
xp_regaddmultistring
xp_regdeletekey
xp_regdeletevalue
xp_regenumvalues
xp_regread
xp_regremovemultistring
xp_regwrite
xp_subdirs
xp_varbintohexstr
Run Code Online (Sandbox Code Playgroud)

sp_MSforeachtable可用于遍历数据库中的所有表.以下是此有用存储过程的一些常见用法

Display the size of all tables in a database
EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?'" …
Run Code Online (Sandbox Code Playgroud)

sql-server undocumented-behavior

7
推荐指数
0
解决办法
2882
查看次数

链接服务器在SQL Server Express中

我正在开发一个应用程序,我在SQL Server Express中有一个本地数据库.在本地数据库中工作期间,我们需要在另一个SQL Server/live服务器上执行查询并返回一个值,并使用此值在本地服务器中执行查询.

对2或3个查询执行此查询时可以,但我有大约5000条记录,我需要执行相同的过程.我已经完成了以上的风格,但它需要花费太多时间.

我发现我们可以在多个服务器上运行查询.

我可以同时在SQL Server Express和服务器上运行查询,并以这种方式运行我的整个查询吗?

我只能从快递到服务器运行查询.

database sql-server linked-server sql-server-express

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

程序集生成失败 - 引用程序集"Interop.Office"没有强名称

我有一个WPF 4项目,用于与VS2010中生成的word文档进行交互,以及一个win form User Control项目,用于将word应用程序托管到其中.和其他com dlls.所有的com dlls都被引用到我的主要wpf应用程序中.我想发布我的项目,以便我可以在另一台机器上安装并执行自动更新,我得到错误:"程序集生成失败 - 引用程序集'Interop.Office'没有强名称." 每个COM Dll的错误.一个DLL引用(Interop.word.dll,interop.office.dll,interop.VBIDE.dll),所有这些dll也引用并用于我的wpf代码.

我发现Strong Signed Assemblies链接有相同的问题,但它没有解决问题.

c# wpf interop winforms-interop

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

为什么我们应该使用temprary对象来引发事件?

大多数情况下,当我们使用MVVM时,我们使用INotifyPropertyChanged接口向绑定提供通知,一般实现如下所示:

public class MyClass : INotifyPropertyChanged
{
    // properties implementation with RaisePropertyChanged

    public event PropertyChangedEventHandler PropertyChanged;
    protected void RaisePropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

每当我从专家那里读到代码时,这对我来说都很好 - 他们写了类似的代码:

public class MyClass : INotifyPropertyChanged
{
    // properties implementation with RaisePropertyChanged

    public event PropertyChangedEventHandler PropertyChanged;
    protected void RaisePropertyChanged(string propertyName)
    {
        var tempchanged = PropertyChanged;
        if (tempchanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我想知道为PropertyChanged事件创建临时对象的确切原因是什么.

这只是一种好的做法,还是有任何与之相关的其他好处?

我找到了Jon的回答和解释的例子:

了解C#:使用临时变量引发事件

以下是了解此问题的示例代码:

using System;
using System.Collections.Generic;
using …
Run Code Online (Sandbox Code Playgroud)

.net c# wpf

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

比较两个列表时的结果很奇怪

我想比较两个列表.我想检查List2是否包含List1中的任何项目.我得到意想不到的结果 请参阅下面的代码.

测试代码类

class Program
{
    static void Main(string[] args)
    {
        bool loop = true;
        int textcount = 1;
        while (loop)
        {

            var collection1 = GetCollection();
            var collection2 = GetCollection();

            Console.WriteLine("Test No " + textcount.ToString());


            Console.WriteLine("Collection 1 =" + String.Join(", ", collection1.ToArray()));

            Console.WriteLine("Collection 2 =" + String.Join(", ", collection2.ToArray()));

            System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
            watch.Start();
            var hasitem = collection1.Any(item => collection2.Contains(item));

            watch.Stop();

            Console.WriteLine(hasitem.ToString() + "  Found in " + watch.ElapsedTicks.ToString());
            watch.Reset();

            watch.Start();
            var hasAtLeastOne = collection1.Intersect(collection2).Any();
            watch.Stop();
            Console.WriteLine(hasAtLeastOne.ToString() + " …
Run Code Online (Sandbox Code Playgroud)

.net c# .net-4.0

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

如何使用扩展方法覆盖Object.ToString()方法?

所述object.ToString()方法用于任何对象转换为可读文本的字符串.但是如果对象是null,它会抛出一个NullReferenceError.所以我想ToString()用扩展方法覆盖这个方法,如:

public static class StringExt
{
    public string ToString(this object str)
    {           
        if (str == null)
            return System.Convert.ToString(str);

        return str.ToString();
    }
}
Run Code Online (Sandbox Code Playgroud)

但似乎这样从来没有覆盖ToString()的的Object类.

Myclass cls;
//doing something on the other hand. 

cls.ToString();
Run Code Online (Sandbox Code Playgroud)

这里cls.ToString()总是使用Object.ToString()方法.有没有办法实现这个目标?

.net c#

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

未知数据类型从KDB + -79返回

我在KDB +面临一个非常奇怪的问题.从kdb + server返回的数据类型是-79.我无法找到.

任何人都知道那种类型.?

kdb

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