on 2012 May 11 7:55 AM
Hello,
i am looking for a solution to convert a list or any kind of DataSet into an dynamic result for stored procedure in SQLAnywhere 12.
Until today I even didn't managed it to make the sample examples work.
Best Regards
hello,
we managed it to find the answer to this question.
Step: Making the the class
public class Rtest {
public static void GetRows(IDataReader[] readers) { DataTable table = new DataTable("Table"); table.Columns.Add("c1"); table.Columns.Add("c2"); //Add rows for(int i = 0; i<=100;i++) { table.Rows.Add(i*2,i*3); } DataSet set = new DataSet("Result"); set.Tables.Add(table); readers[0] = set.CreateDataReader(); }
}
Step: Create the procedure:
CREATE PROCEDURE CLR_RESULT() RESULT (c1 int, c2 int) DYNAMIC RESULT SETS 1 EXTERNAL NAME 'C:CLRRtest.dll::Rtest.GetRows( IDataReader[] ) ' LANGUAGE CLR;
and this is it!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think the example works because of the missing data types in the column descriptions. See this post for a working example on SQLA 16.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It works in some situations and crashes in others. It might depend on the actual .NET Type of the DataReader column, the expected data type at SQLA, the .NET framework version used and probably moon phase and humidity. I never found out the exact combinations when it worked and when not. Always providing correct data types seems to have solved the issue for me.
User | Count |
---|---|
79 | |
11 | |
10 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.