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); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.Mo_Project model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.Mo_Project model) { return(dal.Add(model)); }