CLR 存储过程
我希望在 CLR 存储过程中使用加密 API。
我已经创建了一个 CLR 存储过程并编写了一个 select 语句,
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Context Connection=true";
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = @"select * from Employee";
SqlDataReader rdr = cmd.ExecuteReader();
现在我希望使用员工编号来过滤结果,该员工编号以加密形式存储在数据库中,我将对其使用加密方法。
现在我不知道如何从 SqlDataReader
中过滤记录。
我希望返回格式为 SqlDataReader
,因为要从 CLR 存储过程返回多条记录,有一种方法 SqlContext.Pipe.Send()
并且此方法仅接受 SqlDataReader
对象。
请指导我。
I wish to use the Cryptography API in CLR stored procedure.
I have created a CLR stored procedure and written a select statement
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "Context Connection=true";
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = @"select * from Employee";
SqlDataReader rdr = cmd.ExecuteReader();
Now I wish to filter the results using the employee Number which is stored in encrypted form in database for which I am going to use the Cryptography methods.
Now I am stuck with how to go about filtering the records from the SqlDataReader
.
I want the return format as SqlDataReader
, as to return multiple records from CLR stored procedure there is one method SqlContext.Pipe.Send()
and this method accepts only SqlDataReader
objects.
Please guide me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我正在考虑一个类似的问题,我想在返回结果之前进行一些操作。
目前我能看到的唯一方法是使用:
然后在完成后调用
SqlContext.Pipe.SendResultsEnd
。如果有更好的方法我也想知道!
I'm looking at a similar problem where I want to do some manipulation before returning the results.
The only way I can see at the moment is to use:
Then call
SqlContext.Pipe.SendResultsEnd
when you're done.If theres a better way I'd like to know too!