MySqlCommand Methods
Note
If you're unable to delete objects from the MySQL server, it is possible that the server is running in safe mode. To disable safe mode, you can run the following query:
SET SQL_SAFE_UPDATES=0;.
Important Points
- We use
ExecuteNonQueryfor commands which modify the database; ExecuteReaderandExecuteScalarare for querying commands that retrieve data from the database;ExecuteReaderreturns aMySqlDataReaderobject;MySqlDataReaderhas a method calledread()which reads the rows in a sequential manner; We need toClose()theMySqlDataReaderobject after use;ExecuteScalarreturns anobjectwhich can be type-casted into the appropriate data type.
1. The following command selects and returns all the students that have marks higher than 90, which command is the most appropriate for executing this query?
2. The following command selects and returns the name of the oldest student in the class, which command is the most appropriate for executing this query?
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 8
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 2.22
MySqlCommand Methods
Swipe to show menu
Note
If you're unable to delete objects from the MySQL server, it is possible that the server is running in safe mode. To disable safe mode, you can run the following query:
SET SQL_SAFE_UPDATES=0;.
Important Points
- We use
ExecuteNonQueryfor commands which modify the database; ExecuteReaderandExecuteScalarare for querying commands that retrieve data from the database;ExecuteReaderreturns aMySqlDataReaderobject;MySqlDataReaderhas a method calledread()which reads the rows in a sequential manner; We need toClose()theMySqlDataReaderobject after use;ExecuteScalarreturns anobjectwhich can be type-casted into the appropriate data type.
1. The following command selects and returns all the students that have marks higher than 90, which command is the most appropriate for executing this query?
2. The following command selects and returns the name of the oldest student in the class, which command is the most appropriate for executing this query?
Everything was clear?
Thanks for your feedback!
SectionΒ 3. ChapterΒ 8