Reputation: 1
I want execute the following command text(sql statement) which command I need to use?
command.CommandText="select Fname from table_name where Lname='abc'"
I need to use ExecutScalar or ExecuteReader command, could you please confirm.
Upvotes: 0
Views: 87
Reputation: 51514
Either will work. It depends on the expected results.
If you are only returning a single value, ExecuteScalar
would be preferred.
Otherwise, use ExecuteReader
or fill a DataTable
Upvotes: 2