Conteúdo do Curso
Introduction to .NET with C#
Introduction to .NET with C#
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
ExecuteNonQuery
for commands which modify the database; ExecuteReader
andExecuteScalar
are for querying commands that retrieve data from the database;ExecuteReader
returns aMySqlDataReader
object;MySqlDataReader
has a method calledread()
which reads the rows in a sequential manner; We need toClose()
theMySqlDataReader
object after use;ExecuteScalar
returns anobject
which 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?
Obrigado pelo seu feedback!