Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public DataTable DisplayProjects()
- {
- try
- {
- using (SQLiteConnection c = new SQLiteConnection(ConnectionString))
- {
- c.Open();
- {
- using (SQLiteDataAdapter adapt = new SQLiteDataAdapter("select * from projects", c))
- {
- DataTable ds = new DataTable();
- adapt.Fill(ds);
- return ds;
- }
- }
- }
- }
- catch (Exception e)
- {
- Debug.WriteLine(e);
- throw;
- }
- }
- public void AddProject(string name, string ismulti)
- {
- try
- {
- string sql = $"INSERT INTO `projects`(`id`,`name`,`is_multi`) VALUES (NULL,'{name}','{ismulti}');";
- using (SQLiteConnection c = new SQLiteConnection(ConnectionString))
- {
- c.Open();
- using (SQLiteCommand cmd = new SQLiteCommand(sql, c))
- {
- cmd.ExecuteNonQuery();
- }
- }
- }
- catch (Exception e)
- {
- Debug.WriteLine(e);
- throw;
- }
- }
Add Comment
Please, Sign In to add comment