Illustrate the use of ExecuteReader method in C#

The ExecuteReader() method executes commands that return rows, such as a SQL SELECT statement. The returned rows are located in an OdbcDataReader, an OleDbDataReader, a SqlDataReader, or an OracleDataReader, depending on which Data Provider you are using.

string cmdString = "SELECT user_name, pass_word FROM LogIn ";
SqlCommand sqlCommand = new SqlCommand();
sqlCommand.Connection = sqlConnection;
sqlCommand.CommandType = CommandType.Text;
sqlCommand.CommandText = cmdString;
sqlDataReader = sqlCommand.ExecuteReader();

Enjoyed this post? Share it!


Leave a comment

Your email address will not be published.