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

asked 04 Dec '22, 04:33

Arcady%20Abramov's gravatar image

Arcady Abramov
143141521
accept rate: 0%

edited 04 Dec '22, 07:48

Hard to tell without knowing the procedure's definition... does the difference in returned rows also apply when calling the procedure within DBISQL?

Could it be the RESULT clause of the procedure does not fit the SELECT within the procedure's beody?

(05 Dec '22, 03:43) Volker Barth

Within DB ISQL the result is always correct. This seems to be an issue with defining unique rows in DataReader of SQL anywhere result rows

(06 Dec '22, 01:13) Arcady Abramov
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×219

question asked: 04 Dec '22, 04:33

question was seen: 135 times

last updated: 06 Dec '22, 01:13