小编ala*_*ala的帖子

SQL WHERE .. IN子句多列

我需要在SQL Server中实现以下查询:

select *
from table1
WHERE  (CM_PLAN_ID,Individual_ID)
IN
(
 Select CM_PLAN_ID, Individual_ID
 From CRM_VCM_CURRENT_LEAD_STATUS
 Where Lead_Key = :_Lead_Key
)
Run Code Online (Sandbox Code Playgroud)

但WHERE..IN子句只允许1列.如何将2个或更多列与另一个内部SELECT进行比较?

sql-server

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

SQL SELECT多列INTO多变量

我正在将SQL从Teradata转换为SQL Server

在Teradata,他们有格式

SELECT col1, col2
FROM table1
INTO @variable1, @variable2
Run Code Online (Sandbox Code Playgroud)

在SQL Server中,我找到了

SET @variable1 = (
SELECT col1 
FROM table1
);
Run Code Online (Sandbox Code Playgroud)

这只允许每个语句使用一个列/变量.如何使用单个SELECT语句分配2个或更多变量?

sql sql-server teradata

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

单个app.config多项目c#

我想通过3个不同的项目使用单个app.config.

如何访问配置?

ConfigurationManager.AppSettings["config1"]
Run Code Online (Sandbox Code Playgroud)

c# config

45
推荐指数
6
解决办法
6万
查看次数

如何存储/检索RSA公钥/私钥

我想使用RSA公钥加密.存储或检索私钥和公钥的最佳方法是什么?XML在这里是个好主意吗?

如何获得钥匙?

RSAParameters privateKey = RSA.ExportParameters(true);
RSAParameters publicKey = RSA.ExportParameters(false);
Run Code Online (Sandbox Code Playgroud)

因为RSAParameters具有以下成员:D,DP,DQ,Exponent,InverseQ,Modulus,P,Q

哪一个是关键?

.net c# cryptography rsa

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

如何使用RSA加密C#中的文件(大数据)

我是加密新手.我需要实现非对称加密算法,我认为它使用私钥/公钥.我开始使用RSACryptoServiceProvider的示例.加密的小数据是可以的.但是当在相对较大的数据"2行"上使用它时,我得到异常CryptographicException"Bad Length"!

//Create a new instance of RSACryptoServiceProvider.
using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider())
{

    //Import the RSA Key information. This only needs
    //toinclude the public key information.
    //RSA.ImportParameters(RSAKeyInfo);
    byte[] keyValue = Convert.FromBase64String(publicKey);
    RSA.ImportCspBlob(keyValue);

    //Encrypt the passed byte array and specify OAEP padding.  
    //OAEP padding is only available on Microsoft Windows XP or
    //later.  
    encryptedData = RSA.Encrypt(DataToEncrypt, DoOAEPPadding);
}
Run Code Online (Sandbox Code Playgroud)

然后我找到了一些使用CryptoStream加密大数据(或文件)的样本,并且只使用DES或3DES等对称算法,它们具有CreateEncryptor函数,将ICryptoTransform作为CryptoStream构造函数的输入之一返回!

CryptoStream cStream = new CryptoStream(fStream,
                new TripleDESCryptoServiceProvider().CreateEncryptor(Key, IV),
                CryptoStreamMode.Write);
Run Code Online (Sandbox Code Playgroud)

使用RSA加密文件的方法是什么?

c# 3des cryptography rsa encryption-asymmetric

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

如何用C#编写超高速文件流代码?

我必须将一个巨大的文件拆分成许多较小的文件.每个目标文件由偏移量和长度定义为字节数.我正在使用以下代码:

private void copy(string srcFile, string dstFile, int offset, int length)
{
    BinaryReader reader = new BinaryReader(File.OpenRead(srcFile));
    reader.BaseStream.Seek(offset, SeekOrigin.Begin);
    byte[] buffer = reader.ReadBytes(length);

    BinaryWriter writer = new BinaryWriter(File.OpenWrite(dstFile));
    writer.Write(buffer);
}
Run Code Online (Sandbox Code Playgroud)

考虑到我必须将此功能调用大约100,000次,因此速度非常慢.

  1. 有没有办法让Writer直接连接到Reader?(也就是说,实际上没有将内容加载到内存中的Buffer中.)

c# cpu streaming performance utilization

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

密钥容器,足够安全存储私钥?

我正在阅读.NET中的密钥容器,作为存储非密钥加密和数字签名私钥的安全场所.

我的问题是密钥容器的安全性如何?因为我发现如果我知道密钥容器名称,那么我将能够使用以下内容检索私钥:

// Create the CspParameters object and set the key container 
// name used to store the RSA key pair.
CspParameters cp = new CspParameters();
cp.KeyContainerName = ContainerName;

// Create a new instance of RSACryptoServiceProvider that accesses
// the key container MyKeyContainerName.
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cp);

// Display the key information to the console.
Console.WriteLine("Key retrieved from container : \n {0}", rsa.ToXmlString(true));
Run Code Online (Sandbox Code Playgroud)

密钥容器是否是存储私钥的安全位置?

.net cryptography keystore

19
推荐指数
1
解决办法
6542
查看次数

如何在MVC 3中设置图表系列颜色?

我正在使用

System.Web.Helpers.Chart

在我的MVC3应用程序中显示图表.

@{
    var myChart = new Chart(width: 600, height: 400)
        .AddTitle("Resource Utilization in Projects in Week 1")
        .AddSeries(
            name: "Project1",
            chartType: "StackedColumn",
            xValue: new[] { "W1", "W2", "W3", "W4", "W5" },
            yValues: new[] { 80, 60, 40, 20, 10}
        )
        .AddSeries(
            name: "Project2",
            chartType: "StackedColumn",
            xValue: new[] { "W1", "W2", "W3", "W4", "W5" }, 
            yValues: new[] { 10, 10, 0, 10, 10 }
        )
        .AddSeries(
            name: "Available",
            chartType: "StackedColumn",
            xValue: new[] { "W1", "W2", "W3", "W4", "W5" }, …
Run Code Online (Sandbox Code Playgroud)

asp.net charts colors razor asp.net-mvc-3

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

如何在没有FETCH的情况下访问光标列.. INTO

我正在使用SQL Server来构建存储过程,而我正在使用游标来遍历select语句

我将游标定义如下:

DECLARE @c_col1 varchar(max);
DECLARE @c_col2 varchar(max);

DECLARE c as CURSOR FOR 
SELECT col1, col2 
FROM table;

OPEN c;
FETCH NEXT FROM c INTO
@c_col1, @c_col2;

SELECT @c_col1, @c_col2;
Run Code Online (Sandbox Code Playgroud)

有没有办法访问游标的列而不需要为每列声明变量并在FETCH子句中使用INTO?换句话说,是否可以使用:

DECLARE c as CURSOR FOR 
SELECT col1, col2 
FROM table;

OPEN c;
FETCH NEXT FROM c; 

SELECT c.col1, c.col2;
Run Code Online (Sandbox Code Playgroud)

sql sql-server cursor

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

基于.NET的安装项目在安装时失败

我使用Visual Studio 2008创建了一个安装项目.在其他计算机上安装时,出现以下错误:

在安装MyApplication之前,安装程序已中断.您需要重新启动安装程序才能重试.

我该如何解决这个问题?

日志文件显示以下内容.

MSI (s) (D8:20) [14:06:01:020]: Executing op: ComponentUnregister(ComponentId={533BAFA2-3A54-B4D7-B625-38EB0DB9BBB7},ProductKey={B10107EF-3C57-451E-9080-40FB1F4A8B95},BinaryType=0,)
MSI (s) (D8:20) [14:06:01:020]: Executing op: ComponentUnregister(ComponentId={B55DBDAF-0BCB-061A-9EA2-5AC798377ABA},ProductKey={B10107EF-3C57-451E-9080-40FB1F4A8B95},BinaryType=0,)
MSI (s) (D8:20) [14:06:01:020]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=0)
MSI (s) (D8:20) [14:06:01:020]: Error in rollback skipped.  Return: 5
MSI (s) (D8:20) [14:06:01:030]: No System Restore sequence number for this installation.
MSI (s) (D8:20) [14:06:01:030]: Unlocking Server
MSI (s) (D8:20) [14:06:01:030]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.
Action ended 14:06:01: INSTALL. Return value 3.
MSI (s) …
Run Code Online (Sandbox Code Playgroud)

.net deployment installation windows-installer

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