Пример #1
0
 public void ConnectTest()
 {
     try
     {
         if (objDB != null)
         {
             Assert.AreEqual(true, objDB.Connect());
         }
     }
     finally
     {
         objDB.Disconnect();
     }
 }
Пример #2
0
        public void BeginTransTest()
        {
            SQLServer objDB = null;

            try
            {
                objDB = TestEnvJudge();
                if (objDB != null)
                {
                    if (objDB.Connect())
                    {
                        Assert.AreEqual(true, objDB.BeginTrans());

                        objDB.RollBack();
                    }
                }
            }
            finally
            {
                if (objDB.Connect())
                {
                    objDB.Disconnect();
                }
                objDB = null;
            }
        }
Пример #3
0
        public void GetTableLockInfoTest()
        {
            SQLServer objDB = null;

            try
            {
                objDB = TestEnvJudge();
                if (objDB != null)
                {
                    if (objDB.Connect())
                    {
                        objDB.BeginTrans();
                        objDB.ExecuteNonQuery("insert into get_test values (NEXT VALUE FOR get_test_sequence,'','',SYSDATETIME(),SYSDATETIMEOFFSET())");
                        Assert.AreNotEqual(true, objDB.GetTableLockInfo("get_test"));
                        objDB.RollBack();
                    }
                }
            }
            finally
            {
                if (objDB.Connect())
                {
                    objDB.Disconnect();
                }
                objDB = null;
            }
        }
Пример #4
0
        public void CreateAndDropTableTest()
        {
            SQLServer objDB  = null;
            Random    random = new Random();

            try
            {
                objDB = TestEnvJudge();
                if (objDB != null)
                {
                    if (objDB.Connect())
                    {
                        int ret = objDB.ExecuteNonQuery("CREATE TABLE Test_" +
                                                        DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + DateTime.Now.Millisecond +
                                                        " (id int NOT NULL PRIMARY KEY, col_1 nvarchar(10) NULL, col_2 nvarchar(10) NULL, col_3 nvarchar(10) NULL);");
                        Assert.AreEqual(1, ret);
                    }
                }
            }
            finally
            {
                if (objDB.Connect())
                {
                    objDB.Disconnect();
                }
                objDB  = null;
                random = null;
            }
        }
Пример #5
0
        static void Main(string[] args)
        {
            var ss = new SQLServer();
            var ok = ss.Connect("localhost", "sqlexpress", "EdDb");

            var students = ss.ExcecuteQuery("SELECT * From Student;");

            ss.Disconnect();
        }
Пример #6
0
        static void Main(string[] args)
        {
            string word      = "fast";
            string character = Convert.ToString(word[0]);
            var    ss        = new SQLServer();
            var    ok        = ss.Connect("localhost", "sqlexpress", "EdDb");
            var    students  = ss.ExecuteQuery("SELECT * From Student;");

            ss.Disconnect();
        }
Пример #7
0
        public void ConnectTest()
        {
            SQLServer objDB = null;

            try
            {
                objDB = TestEnvJudge();
                if (objDB != null)
                {
                    Assert.AreEqual(true, objDB.Connect());
                }
            }
            finally
            {
                objDB.Disconnect();
                objDB = null;
            }
        }
Пример #8
0
        public void GetDataTest()
        {
            SQLServer objDB = null;

            try
            {
                objDB = TestEnvJudge();
                if (objDB != null)
                {
                    if (objDB.Connect())
                    {
                        DataTable dataTable = objDB.ExecuteReader("SELECT * FROM get_test");
                    }
                }
            }
            finally
            {
                if (objDB.Connect())
                {
                    objDB.Disconnect();
                }
                objDB = null;
            }
        }