var collection = from t1 in dt1.AsEnumerable()
join t2 in dt2.AsEnumerable()
on t1["id"] equals t2["id"]
select new { Name = t1["name"], Group = t2["group"] };
Run Code Online (Sandbox Code Playgroud)
我想选择两个表的所有列,如 SQL Server 内部连接查询中的连接。
另外如何将两个表的整个结果转换为数据表?
我使用了以下函数,但解密 1100 条联系我们表格的记录需要 50 秒到 1 分钟。所以我过滤一些东西大约需要1分钟的时间。因为我需要加密整个数据,所以我在 C# 中触发过滤器查询。
这是加密方法:
public static string Encrypt(string encryptString)
{
if (string.IsNullOrEmpty(encryptString))
return encryptString;
string EncryptionKey = "---";
byte[] clearBytes = Encoding.Unicode.GetBytes(encryptString);
using (Aes encryptor = Aes.Create())
{
Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(EncryptionKey, new byte[]
{
0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76
});
encryptor.Key = pdb.GetBytes(32);
encryptor.IV = pdb.GetBytes(16);
using (MemoryStream ms = new MemoryStream())
{
using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateEncryptor(), CryptoStreamMode.Write))
{
cs.Write(clearBytes, 0, …Run Code Online (Sandbox Code Playgroud)