I want to get start with DayPilot control I do not use SQLite and this control documented based on SQLite.
I want to use SQL instead of SQLite so if you can, please do this for me.
main site with samples http://www.daypilot.org/calendar-tutorial.html
The database contains a single table with the following structure
CREATE TABLE event ( id VARCHAR(50), name VARCHAR(50), eventstart DATETIME, eventend DATETIME);
Loading Events
private DataTable dbGetEvents(DateTime start, int days) {
SQLiteDataAdapter da = new SQLiteDataAdapter("SELECT [id], [name], [eventstart], [eventend] FROM [event] WHERE NOT (([eventend] <= @start) OR ([eventstart] >= @end))", ConfigurationManager.ConnectionStrings["db"].ConnectionString);
da.SelectCommand.Parameters.AddWithValue("start", start);
da.SelectCommand.Parameters.AddWithValue("end", start.AddDays(days));
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
Update
private void dbUpdateEvent(string id, DateTime start, DateTime end) {
using (SQLiteConnection con = new SQLiteConnection(ConfigurationManager.ConnectionStrings["db"].ConnectionString))
{
con.Open();
SQLiteCommand cmd = new SQLiteCommand("UPDATE [event] SET [eventstart] = @start, [eventend] = @end WHERE [id] = @id", con);
cmd.Parameters.AddWithValue("id", id);
cmd.Parameters.AddWithValue("start", start);
cmd.Parameters.AddWithValue("end", end);
cmd.ExecuteNonQuery();
}
}