首页 新闻 会员 周边 捐助

代码生成器父子表事务问题

0
悬赏园豆:30 [已关闭问题]

请教各位:
我使用动软的代码生成器生成了一个DAL类:

        public int Add(LangRen.Model.LR_Users model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into LR_Users(");
            strSql.Append("U_LoginName,U_LoginPwd,P_ID,U_CreateDate,U_CancelDate)");
            strSql.Append(" values (");
            strSql.Append("@U_LoginName,@U_LoginPwd,@P_ID,@U_CreateDate,@U_CancelDate)");
            strSql.Append(";set @ReturnValue= @@IDENTITY");
            SqlParameter[] parameters = {
     new SqlParameter("@U_LoginName", SqlDbType.VarChar,50),
     new SqlParameter("@U_LoginPwd", SqlDbType.VarChar,50),
     new SqlParameter("@P_ID", SqlDbType.Int,4),
     new SqlParameter("@U_CreateDate", SqlDbType.DateTime),
     new SqlParameter("@U_CancelDate", SqlDbType.DateTime),
     new SqlParameter("@ReturnValue",SqlDbType.Int)};
            parameters[0].Value = model.U_LoginName;
            parameters[1].Value = model.U_LoginPwd;
            parameters[2].Value = model.P_ID;
            parameters[3].Value = model.U_CreateDate;
            parameters[4].Value = model.U_CancelDate;
            parameters[5].Direction = ParameterDirection.Output;

            List<CommandInfo> sqllist = new List<CommandInfo>();
            CommandInfo cmd = new CommandInfo(strSql.ToString(), parameters);
            sqllist.Add(cmd);
            StringBuilder strSql2;
            foreach (LangRen.Model.LR_ParticularUsers models in model.LR_ParticularUserss)
            {
                strSql2 = new StringBuilder();
                strSql2.Append("insert into LR_ParticularUsers(");
                strSql2.Append("PU_Sex,PU_Age,PU_Address,PU_Photo,PU_PwdQuestion,PU_PwdAnswer,PU_Score,PU_SendCard,PU_BackCard,PU_UploadFile,U_ID,PU_DownloadFile,PU_Logins,PU_LastLogin,PU_AdminSpeak,PU_Content,PU_UserName,PU_Position,PU_Email,PU_Tel,PU_FamilyTel,PU_QQ)");
                strSql2.Append(" values (");
                strSql2.Append("@PU_Sex,@PU_Age,@PU_Address,@PU_Photo,@PU_PwdQuestion,@PU_PwdAnswer,@PU_Score,@PU_SendCard,@PU_BackCard,@PU_UploadFile,@U_ID,@PU_DownloadFile,@PU_Logins,@PU_LastLogin,@PU_AdminSpeak,@PU_Content,@PU_UserName,@PU_Position,@PU_Email,@PU_Tel,@PU_FamilyTel,@PU_QQ)");
                SqlParameter[] parameters2 = {
      new SqlParameter("@PU_Sex", SqlDbType.Bit,1),
      new SqlParameter("@PU_Age", SqlDbType.TinyInt,1),
      new SqlParameter("@PU_Address", SqlDbType.VarChar,120),

                parameters2[0].Value = models.PU_Sex;
                parameters2[1].Value = models.PU_Age;
                parameters2[2].Value = models.PU_Address;
                ..................

                cmd = new CommandInfo(strSql2.ToString(), parameters2);
                sqllist.Add(cmd);
            }
            DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist);
            return (int)parameters[5].Value;
        }

问题:

            foreach (LangRen.Model.LR_ParticularUsers models in model.LR_ParticularUserss)

这当中的 in model.LR_ParticularUserss 中什么意思 我的类中也没有 LR_ParticularUserss

是代码生成器自已生成的, 运行时提示找不到 LR_ParticularUserss

 

谢谢高手们帮忙,我是小鸟。。。。

itwebzhang的主页 itwebzhang | 初学一级 | 园豆:170
提问于:2009-12-18 13:44
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册