ExecuteScalar
is typically used when your query returns a single value. If it returns more, then the result is the first column of the first row. An example might beSELECT @@IDENTITY AS 'Identity'
.ExecuteReader
is used for any result set with multiple rows/columns (e.g.,SELECT col1, col2 from sometable
).ExecuteNonQuery
is typically used for SQL statements without results (e.g., UPDATE, INSERT, etc.).
ExecuteScalar,ExecuteReader,ExecuteNonQuery区别
最新推荐文章于 2019-12-13 10:24:08 发布
