cancel
Showing results for 
Search instead for 
Did you mean: 

SADataAdapter and SADataReader return different results for the same SQL

0 Kudos
530

Hello, all I found a strange issue while trying to fill a datatable from C# using ExecuteReaderAsync command. The problem seems to be in DataTable.Load() function.

For the same exact SQL when I use this code (returns 201 rows):

//--------------------------------

            cmd = (SACommand)cmd;
            CancellationTokenSource cts = new CancellationTokenSource(cmd.CommandTimeout * 1000);
            var ret = await cmd.ExecuteReaderAsync(CommandBehavior.SingleResult, cts.Token);
            return (SADataReader)ret;

//----------------------------------

Less rows return than when I use old adapter code (returns 231 rows):

//---------------------------------

                var sqlDataAdapter = new SADataAdapter((SACommand)tempinput);
                sqlDataAdapter.Fill((DataTable)ret.DataTable);

//------------------------------------

Can someone point me into the direction of how this can be fixed. I did check that even if the async part is removed, the number of returned rows is still incorrect (lower than it should be) What can I check here?

UPDATE: I see that if I add order by to my stored procedure in the SQL it returns even more rows than it should. There are duplicate rows in the result set, which makes 0 sense. Any ideas?

UPDATE 2: When using "select * from proc", instead of "call proc" the returned data is correct.

Thank you

Arcady

Accepted Solutions (0)

Answers (0)