本文整理汇总了C#中IDnaDataReader.ExecuteWithOpenKey方法的典型用法代码示例。如果您正苦于以下问题:C# IDnaDataReader.ExecuteWithOpenKey方法的具体用法?C# IDnaDataReader.ExecuteWithOpenKey怎么用?C# IDnaDataReader.ExecuteWithOpenKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDnaDataReader
的用法示例。
在下文中一共展示了IDnaDataReader.ExecuteWithOpenKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateUserEmailAddress
void UpdateUserEmailAddress(IDnaDataReader reader, int userId, string email)
{
string sql;
if (email != null)
sql = string.Format(@"update users set encryptedemail=dbo.udf_encryptemailaddress('{0}',{1}) where userid={1}",email,userId);
else
sql = string.Format(@"update users set encryptedemail=dbo.udf_encryptemailaddress(NULL,{0}) where userid={0}",userId);
reader.ExecuteWithOpenKey(sql);
reader.Close();
}
示例2: HashEmailAddress
SqlBinary HashEmailAddress(IDnaDataReader reader,string email)
{
reader.ExecuteWithOpenKey("select dbo.udf_hashemailaddress('" + email + "') AS HashedEmail");
reader.Read();
var hashedEmail = reader.GetSqlBinary("HashedEmail");
reader.Close();
return hashedEmail;
}
示例3: values
// create procedure fetcharticlemoderationhistory @h2g2id int
/*
use smallguide
begin tran
select j1.forumid,u1.*
FROM Users u1
INNER JOIN Journals J1 ON J1.UserID = u1.UserID and J1.SiteID = 1
--INNER JOIN FaveForums f ON f.ForumID = J1.ForumID
--INNER JOIN Users u ON f.UserID = u.UserID
--INNER JOIN Journals J on J.UserID = u.UserID --and J.SiteID = 1
--INNER JOIN Forums fo ON fo.ForumID = J.ForumID
insert FaveForums values (5819,5)
exec watchingusers @userid =5, @siteid =1, @skip = 0, @show = 100000
rollback tran
use master
*/
#endregion
#region Helper methods
EmailValues GetUserEmailValues(IDnaDataReader reader, int userId)
{
string sql = string.Format(@"SELECT DecryptedEmail = dbo.udf_decryptemailaddress(EncryptedEmail,UserID), EncryptedEmail, HashedEmail FROM Users WHERE UserId=" + userId);
reader.ExecuteWithOpenKey(sql);
reader.Read();
EmailValues emailValues = new EmailValues();
emailValues.DecryptedEmail = reader.GetString("DecryptedEmail");
emailValues.EncryptedEmail = reader.GetSqlBinary("EncryptedEmail");
emailValues.HashedEmail = reader.GetSqlBinary("HashedEmail");
reader.Close();
return emailValues;
}