TABLE-VALUED FUNCTIONS Once SQL Server has called Read(),

TABLE-VALUED FUNCTIONS Once SQL Server has called Read(), it will then want to get the values for the fields read. It does this by using one of the accessors that are part of the ISqlRecord interface. There is an accessor for each type supported by SQL Server. Both of the columns the TVF returns are SqlInt32s, so it will call the GetSqlInt32method and pass in the column that it wants. This is shown next, along with a helper accessor to get the column values. int this[int pos] { get { if (pos == 0) { return current_; } return previous_; } } public SqlInt32 GetSqlInt32(int i) { return new SqlInt32(this[i]); } There are quite a few details in the implementation of ISqlReader and ISqlRecord, but the basic implementation of the BDataclass is shown next. class BData: ISqlReader, ISqlRecord { // the previous number in the sequence int previous_; // the current number in the sequence int current_; int count_ ; int maxCount_; internal BData(int preStart, int start, int count) { previous_ = preStart; current_ = start; maxCount_ = count; this.count_ = 0; } int this[int pos] { get { if (pos == 0) { return current_;

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services

Bookmark the permalink.

Comments are closed.