Exemple #1
0
        public DataTable GetSingleCustomer(int id)
        {
            string sql = "SELECT * FROM customer WHERE ID = @ID";

            SQLiteParameter[] param =
            {
                new SQLiteParameter("@ID", id),
            };

            return(SqliteHelp.ExecuteTable(sql, param));
        }
Exemple #2
0
        public DataTable GetSingleCustomer(string userName)
        {
            string sql = "SELECT * FROM customer WHERE Name = @Name";

            SQLiteParameter[] param =
            {
                new SQLiteParameter("@Name", userName),
            };

            return(SqliteHelp.ExecuteTable(sql, param));
        }
Exemple #3
0
        public int DeleteCustomerInfo(string name)
        {
            string sql = "DELETE FROM customer WHERE Nmae = @name ";

            SQLiteParameter[] para =
            {
                new SQLiteParameter("@name", name),
            };

            return(SqliteHelp.ExecuteNonQuery(sql, para));
        }
Exemple #4
0
        public int DeleteCustomerInfo(int id)
        {
            string sql = "DELETE FROM customer WHERE id = @id ";

            SQLiteParameter[] para =
            {
                new SQLiteParameter("@id", id),
            };

            return(SqliteHelp.ExecuteNonQuery(sql, para));
        }
Exemple #5
0
        public int AddCustomer(customer customer)
        {
            string sql = "INSERT INTO customer VALUES(NULL, @Name, @Age)";

            SQLiteParameter[] param =
            {
                new SQLiteParameter("@Name", customer.Name),
                new SQLiteParameter("@Age",  customer.Age),
            };

            return(SqliteHelp.ExecuteNonQuery(sql, param));
        }
Exemple #6
0
        public int EditCustomer(customer customer)
        {
            string sql = "UPDATE customer SET Name = @Name, Age = @Age WHERE ID = @ID";

            SQLiteParameter[] param =
            {
                new SQLiteParameter("@Name", customer.Name),
                new SQLiteParameter("@Age",  customer.Age),
                new SQLiteParameter("@ID",   customer.ID),
            };

            return(SqliteHelp.ExecuteNonQuery(sql, param));
        }
Exemple #7
0
        public DataTable GetPageList(int startPage, int endPage)
        {
            //string sql = "SELECT * FROM (SELECT *, COUNT(id) AS num FROM customer) AS list WHERE list.num >= @startPage AND list.num <= @endPage";
            string sql = "SELECT * FROM customer LIMIT @startPage OFFSET @endPage";

            SQLiteParameter[] param =
            {
                new SQLiteParameter("@startPage",            10),
                new SQLiteParameter("@endPage",   startPage - 1),
            };

            return(SqliteHelp.ExecuteTable(sql, param));
            //return SqliteHelp.ExecuteTable(sql);
        }
Exemple #8
0
        public DataTable GetAllCustomerInfo()
        {
            string sql = "SELECT * FROM customer";

            return(SqliteHelp.ExecuteTable(sql));
        }
Exemple #9
0
        public int GetRecordCount()
        {
            string sql = "SELECT COUNT(id) FROM customer";

            return(Convert.ToInt32(SqliteHelp.ExecuteScalar(sql)));
        }