0

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

SqlDataReaderCLRストアドプロシージャから複数のレコードを返すには、1つのメソッドがSqlContext.Pipe.Send()あり、このメソッドはオブジェクトのみを受け入れますSqlDataReader

私を案内してください。

4

1 に答える 1

0

結果を返す前に何らかの操作を行いたいという同様の問題を見ています。現時点で私が見ることができる唯一の方法は、使用することです:

// 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そして、終わったら電話。

もっと良い方法があれば私も知りたいです!

于 2011-04-13T08:55:37.417 に答える