Working with SQLite DBHelper
Public classDBHelper {stringConnStr =@"Data source="+ System.Environment.CurrentDirectory +@"\workhelper.db;initial catalog=sqlite;integrated security=true; Max Pool size=10"; /// <summary> ///perform additions, deletions and changes/// </summary> /// <param name= "Sqlstr" ></param> Public BOOLExecuteSQL (stringsqlstr) { using(DbConnection conn =Newsqliteconnection (CONNSTR)) {Conn. Open (); varComm =Conn. CreateCommand (); Comm.commandtext=sqlstr; Comm.commandtype=CommandType.Text; returnComm. ExecuteNonQuery () >0; } } /// <summary> ///execute a query to return a dataset/// </summary> /// <param name= "Sqlstr" ></param> /// <returns></returns> PublicDbDataReader executestring (stringsqlstr) { using(DbConnection conn =Newsqliteconnection (CONNSTR)) {Conn. Open (); varcmd =Conn. CreateCommand (); Cmd.commandtext=sqlstr; Cmd.commandtype=CommandType.Text; returncmd. ExecuteReader (); } } }
Working with SQLite DBHelper