Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data.SQLite;
- using System.Data;
- using System.Reflection;
- using System.IO;
- namespace ADOConn
- {
- public class DAO
- {
- private SQLiteConnection conn;
- private SQLiteCommand comando;
- private SQLiteDataAdapter dta;
- private DataTable dt;
- public string pasta;
- public DAO()
- {
- if (Directory.Exists("BD"))
- {
- foreach (var fileDirectory in Directory.GetFiles("BD", "*.s3db"))
- {
- conn = new SQLiteConnection(string.Format("Data Source={0};", new FileInfo(fileDirectory).DirectoryName + fileDirectory));
- try
- {
- }
- catch (Exception)
- {
- }
- }
- }
- pasta = conn.ConnectionString;
- comando = new SQLiteCommand();
- comando.Connection = conn;
- //conn = new SQLiteConnection(@"data source=C:\ProjetoSVN\ADOConn\BancoConfiguracao.s3db");
- //comando = new SQLiteCommand();
- //comando.Connection = conn;
- }
- public void Insert(string texto)
- {
- comando.CommandText = texto;
- conn.Open();
- comando.ExecuteNonQuery();
- conn.Close();
- }
- public void Delete(string texto)
- {
- comando.CommandText = texto;
- conn.Open();
- comando.ExecuteNonQuery();
- conn.Close();
- }
- public void Update(string texto)
- {
- comando.CommandText = texto;
- conn.Open();
- comando.ExecuteNonQuery();
- conn.Close();
- }
- public DataTable Select(string texto)
- {
- dta = new SQLiteDataAdapter(comando);
- dt = new DataTable();
- comando.CommandText = texto;
- conn.Open();
- dt.Clear();
- dta.Fill(dt);
- conn.Close();
- return dt;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement