Example #1
0
        public static bool Update(string name)
        {
            bool rst = false;

            try
            {
                SqlDbOperHandler doh = new SqlDbOperHandler();
                doh.Reset();
                doh.SqlCmd = "UPDATE Table_test set name ='" + name + "' where (Password ='******') ";
                doh.ExecuteSqlNonQuery();
                doh.Dispose();
                rst = true;
                return(rst);
            }
            catch (Exception e)
            {
                return(rst);
            }
        }
Example #2
0
        public static bool Added(string name, string Password, string id)
        {
            bool rst = false;

            try
            {
                SqlDbOperHandler doh = new SqlDbOperHandler();
                doh.Reset();
                doh.SqlCmd = "insert into Table_test (name,Password,id) values ('" + name + "'," + Password + ",'" + id + "')";
                doh.ExecuteSqlNonQuery();
                doh.Dispose();
                rst = true;
                return(rst);
            }
            catch (Exception e)
            {
                return(rst);
            }
        }
Example #3
0
        public static bool Deleteing(string name)
        {
            bool rst = false;

            try
            {
                SqlDbOperHandler doh = new SqlDbOperHandler();
                doh.Reset();
                doh.SqlCmd = "DELETE FROM Table_2 WHERE name = '" + name + "' ";
                doh.ExecuteSqlNonQuery();
                doh.Dispose();
                rst = true;
                return(rst);
            }
            catch (Exception e)
            {
                return(rst);
            }
        }
Example #4
0
        public static bool Added(string contend, string name, string time)
        {
            bool rst = false;

            try
            {
                SqlDbOperHandler doh = new SqlDbOperHandler();
                doh.Reset();
                doh.SqlCmd = "insert into Table_yan (contend,name,time) values ('" + contend + "','" + name + "','" + time + "')";
                doh.ExecuteSqlNonQuery();
                doh.Dispose();
                rst = true;
                return(rst);
            }
            catch (Exception e)
            {
                return(rst);
            }
        }
Example #5
0
        /// <summary>
        /// 将注册的用户更新到表中
        /// </summary>
        /// <param name="name"></param>
        /// <param name="password"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public static bool insertToTabel(string name, string password)
        {
            bool rst = false;

            try
            {
                SqlDbOperHandler doh = new SqlDbOperHandler();
                doh.Reset();
                doh.SqlCmd = " set rowcount 1 update Table_test set name = '" + name + "' where (name is null or name = '') and password = '******' and id = 1 '" + "'";
                doh.ExecuteSqlNonQuery();
                doh.Dispose();
                rst = true;
                return(rst);
            }
            catch (Exception e)
            {
                return(rst);
            }
        }
Example #6
0
        private int InsertTicketsSql(DateTime meal_date, string meal_location, string meal_type, string meal, decimal amount, string identification, string operator_man, DateTime ticketCreate)
        {
            try
            {
                SqlDbOperHandler doh = new SqlDbOperHandler();//开启数据库连接
                doh.Reset();
                doh.SqlCmd = String.Format("insert into [m_t_application] (meal_date,meal_location,meal_type,meal,amount,identification,operator_man,ticketStatus,ticketCreate)" +
                                           " values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}');",
                                           meal_date.Date, meal_location, meal_type, meal, amount.ToString("#0.00"), identification, operator_man, "未使用", ticketCreate); //"insert into [m_t_application] (meal_date,meal_location,,meal_type,meal,amount,identification,operator_man,ticketStatus,ticketCreate) values();";//sql语句
                doh.ExecuteSqlNonQuery();                                                                                                                                //执行不返回的方法
                doh.Dispose();                                                                                                                                           //释放资源
            }
            catch (Exception e)
            {
                //自己写的打印日志的工具类
                LogClass.CreateLog("error:" + e.Message.ToString());
                return(1);
            }

            return(0);
        }