on 2022 Dec 04 4:33 AM
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
Request clarification before answering.
User | Count |
---|---|
61 | |
8 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.