Example #1
0
        string SQL        = string.Empty;  //保持SQL语句

        /// <summary>
        /// 判断表是否存在
        /// </summary>
        /// <returns></returns>
        public bool  CheckData()
        {
            bool RetrunValue = false;

            SQL = "select count(*) from dbo.sysobjects where id=object_id('users') and ObjectProperty(id,N'IsUserTable')=1";
            int row = Convert.ToInt32(mySqlconn.ExecuteSql(SQL));

            if (row > 0)
            {
                RetrunValue = true;
            }
            return(RetrunValue);
        }
Example #2
0
        public string GetUserPassword(string paramUserName)
        {
            Sqlconn mySqlconn   = new Sqlconn();
            DataSet myDs        = new DataSet();
            string  returnValue = string.Empty;
            string  strSql      = "select passwd from user where 1=1";

            if (paramUserName.Length > 0)
            {
                strSql += " and  userName ='******'";
                myDs    = mySqlconn.Query(strSql);

                if (myDs.Tables.Count > 0 && myDs.Tables[0].Rows.Count > 0)
                {
                    returnValue = mySqlconn.ExecuteSql(strSql);
                    return(returnValue);
                }

                return(returnValue);
            }



            return(returnValue);
        }
Example #3
0
        /// <summary>
        ///   获取价格最大值
        /// </summary>
        /// <param name="paramUserName"></param>
        /// <returns></returns>
        public double GetPrice()
        {
            double RetuenValue = 0.0;

            SQL         = "select  isnull (MaxPrice,1) as MaxPrice from PriceMax where 1=1 ";
            RetuenValue = Convert.ToDouble(mySqlconn.ExecuteSql(SQL));
            return(RetuenValue);
        }
Example #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Model.MoIRoleInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_RoleInfo(");
            strSql.Append("RoleID,RoleName,Remark)");
            strSql.Append(" values (");
            strSql.Append("@RoleID,@RoleName,@Remark)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@RoleID",   SqlDbType.Int,       4),
                new SqlParameter("@RoleName", SqlDbType.NVarChar, 20),
                new SqlParameter("@Remark",   SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.RoleID;
            parameters[1].Value = model.RoleName;
            parameters[2].Value = model.Remark;

            mySqlconn.ExecuteSql(strSql.ToString(), parameters);
        }
Example #5
0
        public bool Add(Model.Mo_Project model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into project ");
            strSql.Append("(project_no, project_name, project_header, project_start_date, project_end_date, project_company, project_contact, contact_phone, remark) ");
            strSql.Append("values ");
            strSql.Append("(@project_no,@project_name,@project_header,@project_start_date,@project_end_date,@project_company,@project_contact,@contact_phone,@remark)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@project_no",         SqlDbType.NVarChar),
                new SqlParameter("@project_name",       SqlDbType.VarChar),
                new SqlParameter("@project_header",     SqlDbType.NVarChar),
                new SqlParameter("@project_start_date", SqlDbType.DateTime),
                new SqlParameter("@project_end_date",   SqlDbType.DateTime),
                new SqlParameter("@project_company",    SqlDbType.NVarChar),
                new SqlParameter("@project_contact",    SqlDbType.NVarChar),
                new SqlParameter("@contact_phone",      SqlDbType.NVarChar),
                new SqlParameter("@remark",             SqlDbType.NVarChar)
            };
            parameters[0].Value = model.projectNo;
            parameters[1].Value = model.projectName;
            parameters[2].Value = model.projectHeader;
            parameters[3].Value = model.projectStartDate;
            parameters[4].Value = model.projectEndDate;
            parameters[5].Value = model.projectCompany;
            parameters[6].Value = model.projectContact;
            parameters[7].Value = model.contactPhone;
            parameters[8].Value = model.remark;

            int rows = mySqlconn.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }