Steven Nagy wrote:
Yes, ExecuteScalar returns 1 value, ExecuteReader returns a dataReader
for multiple rows, although its theoretically possible that only one 1
row with 1 column is returned.
If you KNOW that your dataset has only 1 row with 1 column in it, then
you can reference that value as:
double d = (decimal)dsMyDataSet.Tables[0].Rows[0][0];
This is what I eventually used, however I wanted a single value from a
table with multiple rows, so I also had to use the select method on
Tables, and use a rowfilter...
In your scenario, would it be possible to further filter the data
BEFORE it gets delivered into the dataset?
For example, you could use a stored procedure to refine what's being
returned, or even a View, instead of selecting directly from the table.
What I have is a dataset that has multiple tables in it. One of these
tables has just one row in it that used for editing and this data is
being displayed on a form. The other tables are used for lookupvalues
in combo boxes. The edit table is joined to lookup_table1 (that
provides values for combo box1) and that is joined to lookup_table2
(that provides values for combo box 2). Combo box 2 is initially set
from combo box 1 (whatever is loaded) then after that, modifying combo
box 2 alters the set of selectable items in combo box 1...
Does that make *some* sort of sense?
If anyone would like some code, or further explanation of what it is I
am doing am happy to provide it.
Thanks,
Peter