日期:2014-05-18 浏览次数:20489 次
#region 数据访问处理方法[自动生成].
/// <summary>
/// 将数据实体写入数据库.
/// </summary>
public bool Add(RM.Entity.Admin MyEntity)
{
StringBuilder strSql=new StringBuilder();
strSql.Append("INSERT INTO " + this.strTableName + "(");
strSql.Append("[AdminName],");
strSql.Append("[Password],");
strSql.Append("[Truename],");
strSql.Append("[Duty],");
strSql.Append("[Email],");
strSql.Append("[Address],");
strSql.Append("[Telephone],");
strSql.Append("[Sex],");
strSql.Append("[CreateTime],");
strSql.Append("[LoginCount],");
strSql.Append("[LoginIP],");
strSql.Append("[LastLogin],");
strSql.Append("[UserGroup]");
strSql.Append(")VALUES(");
strSql.Append("@AdminName,@Password,@Truename,@Duty,@Email,@Address,@Telephone,@Sex,@CreateTime,@LoginCount,@LoginIP,@LastLogin,@UserGroup)");
RM.DataProvider.SqlDBO.SqlCmdParam[] MyParam = {
MyDBO.CreateNewParam("@AdminName", SqlDbType.VarChar, MyEntity.AdminName),
MyDBO.CreateNewParam("@Password", SqlDbType.VarChar, MyEntity.Password),
MyDBO.CreateNewParam("@Truename", SqlDbType.VarChar, MyEntity.Truename),
MyDBO.CreateNewParam("@Duty", SqlDbType.VarChar, MyEntity.Duty),
MyDBO.CreateNewParam("@Email", SqlDbType.VarChar, MyEntity.Email),
MyDBO.CreateNewParam("@Address", SqlDbType.VarChar, MyEntity.Address),
MyDBO.CreateNewParam("@Telephone", SqlDbType.VarChar, MyEntity.Telephone),
MyDBO.CreateNewParam("@Sex", SqlDbType.VarChar, MyEntity.Sex),
MyDBO.CreateNewParam("@CreateTime", SqlDbType.SmallDateTime, MyEntity.CreateTime),
MyDBO.CreateNewParam("@LoginCount", SqlDbType.Int, MyEntity.LoginCount),
MyDBO.CreateNewParam("@LoginIP", SqlDbType.VarChar, MyEntity.LoginIP),
MyDBO.CreateNewParam("@LastLogin", SqlDbType.SmallDateTime, MyEntity.LastLogin),
MyDBO.CreateNewParam("@UserGroup", SqlDbType.VarChar, MyEntity.UserGroup)
};
bool result = false;
if(MyDBO.ExecuteNonQuery(strSql.ToString(), MyParam) > 0)
{
result = true;
}
return result;
}