开发者

ASP.Net VB - Change rows on gridview depending on SQL Query Result

开发者 https://www.devze.com 2023-01-28 23:00 出处:网络
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 r

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 :)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号