首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CLR存储过程

CLR存储过程
EN

Stack Overflow用户
提问于 2011-04-12 21:39:41
回答 1查看 361关注 0票数 0

我希望在CLR存储过程中使用加密API。

我已经创建了一个CLR存储过程并编写了一条select语句

代码语言:javascript
复制
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对象。

请给我引路。

EN

回答 1

Stack Overflow用户

发布于 2011-04-13 16:55:37

我正在研究一个类似的问题,我想在返回结果之前进行一些操作。目前我能看到的唯一方法是使用:

代码语言:javascript
复制
// Note you need to pass an array of SqlMetaData objects to represent your columns
// to the constructor of SqlDataRecord

SqlDataRecord record = new SqlDataRecord();

// Use the Set methods on record to supply the values for the first row of data
SqlContext.Pipe.SendResultsStart(record);

// for each record you want to return
// use set methods on record to populate this row of data

SqlContext.Pipe.SendResultsRow(record);

然后在完成后调用SqlContext.Pipe.SendResultsEnd

如果有更好的方法,我也想知道!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5636136

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档