Пример #1
0
        public void SQLCEReadAfterUpdateTest()
        {
            SQLStore LSQLStore = new SQLCEStore();

            LSQLStore.ConnectionString = @"Data Source=TestDatabase.sdf";
            LSQLStore.Initialize();
            SQLStoreReadAfterUpdateTest(LSQLStore);
        }
Пример #2
0
        public void SQLCEStoreTest()
        {
            SQLStore LSQLStore = new SQLCEStore();

            LSQLStore.ConnectionString = @"Data Source=E:\Users\Luxspes\Documents\Visual Studio 2008\SqlCE\MyDatabase1.sdf";
            SQLStoreConnection LConnection = LSQLStore.Connect();
            string             ATableName  = "TableTest";
            List <string>      AColumns    = new List <string>();

            AColumns.Add("ID");
            AColumns.Add("NAME");
            SQLIndex AIndex = new SQLIndex("PK_TableTest", new[] { new SQLIndexColumn("ID") });

            //The table has 2 columns ID (integer) and NAME (nvarchar 50)

                        #if USESQLCONNECTION
            LConnection.BeginTransaction(SQLIsolationLevel.ReadCommitted);
                        #else
            LConnection.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
            #endif

            SQLStoreCursor LCursor = LConnection.OpenCursor(ATableName, AColumns, AIndex, true);
            var            LRow    = new object[] { 1, "Hi" };
            LCursor.Insert(LRow);
            LCursor.Dispose();

            LCursor = LConnection.OpenCursor(ATableName, AColumns, AIndex, true);
            LRow    = new object[] { 2, "Bye" };
            LCursor.Insert(LRow);
            LCursor.Dispose();

            LCursor = LConnection.OpenCursor(ATableName, AColumns, AIndex, true);
            LCursor.SetRange(null, null);
            LCursor.Dispose();


            LCursor = LConnection.OpenCursor(ATableName, AColumns, AIndex, true);
            LCursor.Next();
            LCursor.Dispose();


            LConnection.CommitTransaction();
        }