Why get error- Unable to open the database file on line da.Fill(dt);?
private void loadResources()
{
DayPilotScheduler1.Resources.Clear();
string roomFilter = "0";
if (DayPilotScheduler1.ClientState["filter"] != null)
{
roomFilter = (string)DayPilotScheduler1.ClientState["filter"]["room"];
}
SQLiteConnection con = new SQLiteConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=Korisnik;Integrated Security=True");
SQLiteDataAdapter da = new SQLiteDataAdapter("SELECT [id], [name], [beds], [bath] FROM [RoomDetails] WHERE beds = @beds or @beds = '0'", con);
da.SelectCommand.Parameters.AddWithValue("beds", roomFilter);
DataTable dt = new DataTable();
da.Fill(dt);
foreach (DataRow r in dt.Rows)
{
string name = (string)r["name"];
string id = (string)r["id"];
string bath = (string)r["bath"];
int beds = Convert.ToInt32(r["beds"]);
string bedsFormatted = (beds == 1) ? "1 bed" : String.Format("{0} beds", beds);
Resource res = new Resource(name, id);
res.Columns.Add(new ResourceColumn(bedsFormatted));
res.Columns.Add(new ResourceColumn(bath));
DayPilotScheduler1.Resources.Add(res);
}
}