Create an appointment through OSQL

When using OSQL, we would first have to import the necessary namespaces:

  • SuperOffice.CRM.Data
  • SuperOffice.Data
  • SuperOffice.Data.SQL

The syntax of this code is similar to that of SQL with the difference being in the keywords.

The following example shows how we could create an appointment using OSQL.

Code

[!code-csharpCS]

Walk-through

Since we are creating an appointment, we would need to create an instance of the AppointmentTableInfo with the use of the TablesInfo class’s GetAppointmentTableInfo():

[!code-csharpCS]

Next, we create an instance of the Insert class that can be used to update the appointment table. After the instance has been created, we would be able to use the instance to update the fields of the appointment table.

[!code-csharpCS]

Once the required fields have been added, a database connection will be made with the use of the ConnectionFactory and the values will be inserted into the database with the ExecuteNonQuery method.

🛈 Note
In OSQL, there is no method that provides default values. It is necessary to insert values to all mandatory columns. If not a runtime exception will occur.