日期:2014-05-18  浏览次数:20478 次

请教,错误:并非所有的代码路径都返回值
错误 1 “UserDao.GetLogin()”:   并非所有的代码路径都返回值
请问如何修改?
public   bool   GetLogin()
        {
                SqlConnection   con   =   null;
                try
                {
                        con   =   new   SqlConnection(cs);
                        SqlCommand   cmd   =   con.CreateCommand();
                        con.Open();
                        cmd.CommandType   =   CommandType.StoredProcedure;
                        cmd.CommandText   =   "WEB_Login ";
                        cmd.Parameters.Add( "@userName ",   SqlDbType.VarChar,   50).Value   =   user.UserName;
                        cmd.Parameters.Add( "@userPwd ",   SqlDbType.VarChar,   50).Value   =   user.UserPwd;
                        object   o   =   cmd.ExecuteScalar();
                        if   (o   !=   null)
                        {
                                int   iCount   =   Int32.Parse(o.ToString());
                                if   (iCount   ==   0)
                                {
                                        return   true;
                                }
                                else
                                {
                                        return   false;
                                }
                        }
                }
                finally
                {
                        if   (con   !=   null)
              &