Reputation: 51
Im trying to change the information on each row depending on the result from the query. Im thinking that at the minute my problem is that I'm only returning the first result from the query into the result.
e.g. query returns row 1 with '1232' row 2 '1243' but result is only ever set to '1232'
I could be wrong but its why I'm here :)
Upvotes: 0
Views: 692
Reputation: 1730
You say that your SQL returns multiple rows, but are using the ExecuteScalar()
to run it. ExecuteScalar will only return a single result, ie the first column of the first row. Sounds like you need to fill a datatable using a SQLDataAdapter
or something else to do what you're looking for.
Also it would be beneficial if you included your SQL statement as rlb indicated.
Upvotes: 2