The newly created appointments in the Schedule control can be saved to the SQL database. It is also possible to update the appointment details in the SQL database while editing or deleting the appointments in the Schedule control by making use of the server-side events.
Refer to the following steps to perform CRUD operations like Add, Edit, and Delete on the Schedule appointments in the SQL database.
Step 2: Create the database table with the necessary fields as follows.
[SQL Table Script]
Note: You can create the table in Visual Studio Itself as a local database or use SQL Server Management Studio.
Step 3: Connect the database to the Schedule control by using the SqlDataSource ASP.NET control as shown.
Step 4: Add the connectionString configuration to the Web.Config page as highlighted in the following code.
Note: Change the ConnectionString value based on your database connection. Here, it is mentioned as the “local database” connection string.
Step 5: Make use of the following server-side events of the Schedule control to perform the CRUD operation. Here, each event is assigned a server-side method name to be invoked at the time of a particular action.
Step 6: Define the server-side methods with appropriate code blocks as shown in the code-behind page.
Step 6: Run the sample. Now, you can perform insert, edit, and delete operations on the schedule appointments that simultaneously reflects in the SQL database.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|
|5159||06/16/2015||08/27/2015||ASP.NET Web Forms||Schedule|