Skip to main content

Sql Helper into Xamarin Forms PCL Project

public abstract class SQLiteConnection : IDisposable {

    public string DatabasePath { get; private set; }
    public bool TimeExecution { get; set; }
    public bool Trace { get; set; }
    public SQLiteConnection(string databasePath) {
         DatabasePath = databasePath;
    }
    public abstract int CreateTable<T>();
    public abstract SQLiteCommand CreateCommand(string cmdText, params object[] ps);
    public abstract int Execute(string query, params object[] args);
    public abstract List<T> Query<T>(string query, params object[] args) where T : new();
    public abstract TableQuery<T> Table<T>() where T : new();
    public abstract T Get<T>(object pk) where T : new();
    public bool IsInTransaction { get; protected set; }
    public abstract void BeginTransaction();
    public abstract void Rollback();
    public abstract void Commit();
    public abstract void RunInTransaction(Action action);
    public abstract int Insert(object obj);
    public abstract int Update(object obj);
    public abstract int Delete<T>(T obj);

    public void Dispose()
    {
        Close();
    }
    public abstract void Close();

}
 
 

Comments

Popular posts from this blog

Create Strong Name Assembly

From a VS.NET command prompt, enter the following: 1. Generate a KeyFile sn -k keyPair.snk 2. Get the MSIL for the assembly ildasm SomeAssembly.dll /out:SomeAssembly.il 3. Rename the original assembly, just in case ren SomeAssembly.dll SomeAssembly.dll.orig 4. Build a new assembly from the MSIL output and your KeyFile ilasm SomeAssembly.il /dll /key= keyPair.snk   more read visit : http://www.geekzilla.co.uk/ViewCE64BEF3-51A6-4F1C-90C9-6A76B015C9FB.htm

Remove Duplicate Row in Sql Query

Method 1: -- Create Sample Table DECLARE @ table TABLE ( data VARCHAR ( 20 ) ) -- Insert Some Data INSERT INTO @ table VALUES ( 'not duplicate row' ) INSERT INTO @ table VALUES ( 'duplicate row' ) INSERT INTO @ table VALUES ( 'duplicate row' ) -- Find out Duplicate rows in table : SELECT   data , COUNT ( data ) nr FROM     @ table GROUP BY data HAVING   COUNT ( data ) > 1 -- Remove Duplicate rows from table SET NOCOUNT ON SET ROWCOUNT 1 WHILE 1 = 1    BEGIN       DELETE    FROM @ table       WHERE     data IN ( SELECT   data                                FROM     @ table            ...