Skip to content

Method Insert

Louis Richard edited this page Nov 22, 2019 · 1 revision

This method execute a given Insert query

  • Parameter
    • string query
      • The Insert query you wish to execute

First, we connect to the database using the ConnectToDatabase method.
Then, using what ConnectToDatabase returns us, we define the next query to be executed using the CommandText attribute.
Finally, using the ExecuteNonQuery attribute, we execute said query.
We then close the Database connection using ConnectToDatabase with the parameter true.

Note : Because we don't care about what ConnectToDatabase returns us when closing the connection, we use an underscore ( _ ) to ignore the return value.
_ = ConnectToDatabase(true);

Clone this wiki locally