不好意思.刚才把帖子分数设置错了.现在重新发. 
现有表A,内有字段 uid,uname.表B,内有字段uid,upwd.当表A插入数据后,表B也插入一条数据.如果都插入成功则返回1,否则返回0.要求使用逻辑层调用数据访问层方法并传参数.然后数据访问层根据所得的参数调用数据库的存储过程.并请在调用存储过程的代码尽可能每行都添加注释.我是新手,越详细越好.谢谢. 
谢谢.

解决方案 »

  1.   

    给个我写的protected static int GetCountByWebInfoType(WebInfoTypes type, int typeid)
    {
                string cmdtext;
                cmdtext =string.Empty;
                List<SqlParameter> ls = new List<SqlParameter>();
                SqlParameter Count = new SqlParameter("@Count", SqlDbType.Int);
                Count.Direction = ParameterDirection.Output;
                ls.Add(Count);
                SqlParameter p;
                cmdtext = "WebInfo_GetWebInfoCountByPtype";
                p = new SqlParameter("@PtypeID", SqlDbType.Int);
                p.Value = typeid;
                ls.Add(p);               
                if (WebDBHelper.Edit(cmdtext, ls, CommandType.StoredProcedure))//WebDBHelper数据库操作类,LZ自己写就可以
                    return int.Parse(Count.Value.ToString());//获取传出参数的值,转换为int型
                else
                    return 0;
            }就这样了