价值没有实现 [英] Value is not coming in function

查看:80
本文介绍了价值没有实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我调用此函数时,值不会出现



错误是..

when i am calling this function values is not coming

Error is..

userName	The name 'userName' does not exist in the current context





我尝试过:





What I have tried:

public static bool Login(string userName, string password, bool persistCookie = false)
       {

           SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Mystring"].ToString();
             var para = new DynamicParameters();
               para.Add("@UserName", userName);
               var para1 = new DynamicParameters();
               para1.Add("@password", password);

               var t  = con.Query<int>("login_pro", null, null, true, 0, CommandType.StoredProcedure).ToList().SingleOrDefault();
               if (t == 1)
               {
                   return true;
               }

               else
               {
                   return false;
               }
       }











当我调用此函数时






when i am calling this function

bool success = objIAccountData.Login(login.username, login.password, false);

推荐答案

检查您的类型案例:C#区分大小写,因此userName与username不同。

如果您的电话引用用户名:

Check your type case: C# is case sensitive, so "userName" is not the same as "username".
If your call is referencing "username":
bool success = objIAccountData.Login(login.username, login.password, false);

它可能需要userName

It's possible it needs "userName"

bool success = objIAccountData.Login(login.userName, login.password, false);

如果您的命名约定一致。

If you are being consistent in your naming conventions.


这篇关于价值没有实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆