Skip to content

Bind the Scheduler control to an SQL Server database and generate queries without the use of SqlCommandBuilder

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/winforms-scheduler-bind-sql-server-customize-update-delete-insert-queries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Scheduler - Bind to an SQL Server database and customize Update-Delete-Insert queries without the use of SqlCommandBuilder

This example demonstrates how to bind the WinForms Scheduler control at runtime. The example shows how to configure appointment mappings and SQL queries in code. This technique allows you to easily modify data-binding options and SQL queries.

In this example, we insert a GETDATE function result into a TimeStamp column to save the modification time along with the modified row:

INSERT INTO CarScheduling (StartTime, EndTime, Subject, TimeStamp) VALUES (@StartTime, @EndTime, @Subject, GetDate())

UPDATE CarScheduling SET StartTime = @StartTime, EndTime = @EndTime, Subject = @Subject, TimeStamp = GetDate() WHERE ID = @ID

DELETE FROM CarScheduling WHERE ID = @ID

Do the following to test this example locally:

  • Set up the "SchedulerBindDynamically" sample database in your SQL Server instance.
  • Use the SchedulerBindDynamically.sql file attached to this example to generate a sample database and table schema.

Note

We do not use the SqlCommandBuilder class to generate SQL queries as shown in How to bind SchedulerControl to MS SQL Server database at runtime. The DbCommandBuilder.ConflictOption property enables optimistic concurrency to prevent a concurrency violation error. Since we do not use this functionality, you might encounter this error when using this example. Read the following MSDN article for additional information: Introduction to Data Concurrency in ADO.NET.

Files to Review

See Also