Returning a table of data from a scalar query RRS feed

  • Question

  • Hi,


    I am running a scalar query per the following:


    SELECT        [Food Description], SUM(Quantity) AS Total, UoM
    FROM            [Eating Event]
    GROUP BY [Food Description], UoM


    When I preview this query in the DataSet designer, the query displays a table of data.  I am trying to render this data in a Datagrid object, but am not having success.




    I figured if I passed the DataSet.Table as a parameter in the call to ScalarQuery() then the results would flood into the TableAdapter and thus the DataGrid (which is associated with the DataSet.Table). 


    This would be consistent then with a standard TableAdapter.Fill(DataSet) construct.  I know by definition a scalar query doesnot return Rows per se, so any advice on how this works and how I should approach the problem would be welcomed.

    Saturday, August 23, 2008 2:35 AM


  • This is not a scalar query. By definition, scalar query is when query returns single value, not single row. In your case you actually might get multiple rows and if you need to get result, you need to use DataSet/DataTable or DataReader.

    Monday, August 25, 2008 11:47 PM