Пример #1
0
        public static bool AddMovie(string title, string releasedate, string genre, float price, string rate)
        {
            string sqlstr = "insert into Movies(Title,ReleaseDate,Genre,Price,Rate) values('<title>','<releasedate>','<genre>',<price>,'<rate>')";

            sqlstr = sqlstr.Replace("<title>", escape(title))
                     .Replace("<releasedate>", escape(releasedate))
                     .Replace("<genre>", escape(genre))
                     .Replace("<price>", price.ToString())
                     .Replace("<rate>", escape(rate));
            return(DataBaseUtility.ExeSqlNoRes(sqlstr));
        }
Пример #2
0
        public static bool UpdateMovie(long id, string title, string releasedate, string genre, float price, string rate)
        {
            string sqlstr = "Update Movies Set Title = '<title>',ReleaseDate = '<releasedate>',Genre = '<genre>',price = <price>,rate = '<rate>' where Id = <id>";

            sqlstr = sqlstr.Replace("<id>", id.ToString())
                     .Replace("<title>", escape(title))
                     .Replace("<releasedate>", escape(releasedate))
                     .Replace("<genre>", escape(genre))
                     .Replace("<price>", price.ToString())
                     .Replace("<rate>", escape(rate));
            return(DataBaseUtility.ExeSqlNoRes(sqlstr));
        }
Пример #3
0
        public static bool DeleteMovie(long id)
        {
            string sqlstr = "Delete from Movies where Id =" + id.ToString();

            return(DataBaseUtility.ExeSqlNoRes(sqlstr));
        }