예제 #1
0
        public void ExecuteQueryCheckingRows()
        {
            var err = "";

            try
            {
                string      strConnection = ClsQuickCode.ProviderSQLserver("sa", "123456", ".", DBName);
                ClsSqlOledb conn          = new ClsSqlOledb();
                conn.ConnectionString = strConnection;
                conn.TimeOut          = 1000;
                conn.StringQuery      = "select * from pelanggan";
                conn.Execute();
                if (conn.HasRows)
                {
                    int       rowsCount = conn.RowCount;
                    DataTable table     = conn.Table;
                }
            }
            catch (Exception ex)
            {
                err = ex.Message;
            }

            Assert.AreEqual(err, "");
        }
예제 #2
0
        public void ExecuteQueryWithNameNavigation()
        {
            var err = "";

            try
            {
                string      strConnection = ClsQuickCode.ProviderSQLserver("sa", "123456", ".", DBName);
                ClsSqlOledb conn          = new ClsSqlOledb();
                conn.ConnectionString = strConnection;
                conn.TimeOut          = 1000;
                conn.Execute("select * from pelanggan");
                for (int i = 0; i < conn.RowCount - 1; i++)
                {
                    string szName = (string)conn["kdplgn"];
                    string CustszContactPerson = (string)conn["nmplgn"];
                    conn.NextRow();
                }
            }
            catch (Exception ex)
            {
                err = ex.Message;
            }

            Assert.AreEqual(err, "");
        }
예제 #3
0
        public void ExecuteQueryWithMoveFirstAndLastNavigation()
        {
            var err = "";

            try
            {
                string      strConnection = ClsQuickCode.ProviderSQLserver("sa", "123456", ".", DBName);
                ClsSqlOledb conn          = new ClsSqlOledb();
                conn.ConnectionString = strConnection;
                conn.TimeOut          = 1000;
                conn.Execute("select * from pelanggan");
                conn.MoveLastRow();
                string szNameLast = (string)conn[0];
                string CustszContactPersonLast = (string)conn[1];
                conn.MoveFirstRow();
                string szNameFirst = (string)conn[0];
                string CustszContactPersonFirst = (string)conn[1];
            }
            catch (Exception ex)
            {
                err = ex.Message;
            }

            Assert.AreEqual(err, "");
        }
예제 #4
0
        public void ConnectionWithFullTextAndTimeOut()
        {
            var err = "";

            try
            {
                string      strConnection = ClsQuickCode.ProviderSQLserver("sa", "123456", ".", DBName);
                ClsSqlOledb conn          = new ClsSqlOledb(strConnection, 1000);
                conn.TestConnection();
            }
            catch (Exception ex)
            {
                err = ex.Message;
            }

            Assert.AreEqual(err, "");
        }
예제 #5
0
        public void ExecuteQuerySetToTableQueryParam()
        {
            var err = "";

            try
            {
                string      strConnection = ClsQuickCode.ProviderSQLserver("sa", "123456", ".", DBName);
                ClsSqlOledb conn          = new ClsSqlOledb();
                conn.ConnectionString = strConnection;
                conn.TimeOut          = 1000;
                DataTable table = conn.Execute("select * from pelanggan");
            }
            catch (Exception ex)
            {
                err = ex.Message;
            }

            Assert.AreEqual(err, "");
        }