Quantcast
Channel: DataSource Controls - SqlDataSource, ObjectDataSource, etc.
Viewing all articles
Browse latest Browse all 956

sqldatareader not loading DataTable with one cell

$
0
0

I'm looping through a few result sets and loading a new DataTable with each one.  It seems though that whenever the reader encounters a result set with only 1 cell of data it loads  the DataTable with nothing or basically zeros rows.

If I examine the sqldatareader and take the first value I can see that there is for instance a numerical value present as there should be, but it just doesn't load the DataTable "string jj has a value present, but no rows are loaded for the DataTable".   Is there something about DataTables and one cell of data that fails?  Of course a dataTable is a bit overkill here, but other than the obvious what is the issue here??

while (drAsync.Read())
                                            {string jj = drAsync[0].ToString();                                                 dtResultX = new DataTable();
                                                dtResultX.Load(drAsync);


                                                //now add dataTable to dataSet
                                                dsResultX.Tables.Add(dtResultX);
                                            }


Viewing all articles
Browse latest Browse all 956

Trending Articles



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