/// <summary> /// 增加一条数据 /// </summary> public int Add(ROYcms.Sys.Model.ROYcms_Role model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into " + PubConstant.date_prefix + "Role("); strSql.Append("name,zhaiyao,Time)"); strSql.Append(" values ("); strSql.Append("@name,@zhaiyao,@Time)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@name", SqlDbType.VarChar, 50), new SqlParameter("@zhaiyao", SqlDbType.VarChar, 100), new SqlParameter("@Time", SqlDbType.DateTime) }; parameters[0].Value = model.name; parameters[1].Value = model.zhaiyao; parameters[2].Value = model.Time; object obj = DbHelpers.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }