Quantcast
Channel: SCN: Message List - SAP SQL Anywhere
Viewing all articles
Browse latest Browse all 2182

Re: Return resultset from CLR

$
0
0

The error appears in Interactive SQL when running either "call procedure()" or "select * from procedure()".

 

I've modified the example that you provided in this folder:


C:\Users\Public\Documents\SQL Anywhere 12\Samples\SQLAnywhere\ExternalEnvironments\CLR


STORED PROCEDURE:


CREATE PROCEDURE CLRGetResultSet1( in p1 integer )

result( c1 integer,c2 char(128) ) dynamic result sets 1

external name 'CLRKalkyle.dll::CLRKalkyle.CLRKalkyle.GetResultSet1( IDataReader[],int )' language CLR



DLL:


namespace CLRKalkyle

{

    public class CLRKalkyle

    {

        public static void GetResultSet1(IDataReader[] readers,int p1)

        {

            // Assume ResultSet_Tab already exists

            readers[0] = SAServerSideConnection.Connection.ExecuteReader("SELECT c1,c2 FROM ResultSet_Tab WHERE c1 = " + p1.ToString() + " ORDER BY c1");

        }

    }

}

 

Test:

 

call GetResultSet1(1);

 

It works fine without the int parameter.


The string 'ExtEnvResultSetNN' starts at 'ExtEnvResultSet01' and increments by 1 for every call of the store procedure.


Viewing all articles
Browse latest Browse all 2182

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>