We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to perform the CRUD operations like insert, update, and delete with the SQL Database?

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 1: Create the ASP.NET application and include the EJWEB Schedule control in it by referring to the link.

 

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.

[Default.aspx]

 

Step 4: Add the connectionString configuration to the Web.Config page as highlighted in the following code.

[Web.Config]

<configuration>

-------------------------------------------

-------------------------------------------

<connectionStrings>

    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-ScheduleCRUDCS-20150607072453.mdf;Initial Catalog=aspnet-ScheduleCRUDCS-20150607072453;Integrated Security=True"

      providerName="System.Data.SqlClient" />

    <add name="ConnectionString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\ScheduleData.mdf;Integrated Security=True"

      providerName="System.Data.SqlClient" />

</connectionStrings>

-------------------------------------------

-------------------------------------------

</configuration>

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.

[Default.aspx]

 

Step 6: Define the server-side methods with appropriate code blocks as shown in the code-behind page.

[Default.aspx.vb]

 

[Default.aspx.cs]

 

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.

 

Sample Links:

C#:

http://www.syncfusion.com/downloads/support/directtrac/134692/ze/ScheduleCRUDCS-1040553939

VB:

http://www.syncfusion.com/downloads/support/directtrac/134692/ze/ScheduleCRUDVB2094783690

Article ID: Published Date: Last Revised Date: Platform: Control:
5159 06/16/2015 08/27/2015 ASP.NET Web Forms Schedule
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.