我正在使用Microsoft SQL Server 2000,我有3个问题。
ntext
字段中。如何搜索此字段?答案 0 :(得分:1)
您可以使用LIKE或PATINDEX()在ntext(或nvarchar(max))列中搜索wildcard表达式。
答案 1 :(得分:0)
我的加密在这里>>
public string Encrypt(string strText, string strEncKey)
{
Byte[] byKey;
Byte[] IV ={ 0x12, 0x34, 0x54, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
byKey = Encoding.UTF8.GetBytes(strEncKey);
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
byte[] inputByteArray = Encoding.UTF8.GetBytes(strText);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write);
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
return Convert.ToBase64String(ms.ToArray());
}
public string Decrypt(string strText, string strEncKey)
{
Byte[] byKey;
Byte[] IV ={ 0x12, 0x34, 0x54, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
Byte[] inputByteArray;
byKey = Encoding.UTF8.GetBytes(strEncKey.Substring(0, 8));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
inputByteArray = Convert.FromBase64String(strText);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(byKey, IV), CryptoStreamMode.Write);
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
return System.Text.Encoding.UTF8.GetString(ms.ToArray());
}
使用>>
Encrypt(value, "&%#@?,:*");
Decrypt(value, "&%#@?,:*");