SqlCommand has ExecuteReader, for executing the command and returning a dataset, ExecuteScalar for returning a single value of a primitive type (int, string, etc.), or executeNonQuery for returning nothing. You can also pass a command to a SqlDataAdapter, and use that to populate a DataTable object.
Please google SqlCommand and you will find LOTS of examples.
2
solved Execute query using C# [closed]