asp.net mvc 查询问题
代码如下:public ActionResult login()
{
string d = Request.Form["id"];
string password = Request.Form["password"];
int id = Convert.ToInt32(d);
var user = from u in spms.members where u.password==password select u;
if ( user.Count()>0 )
{
return RedirectToAction("test");
}
else
{
return RedirectToAction("Index");
}
}
为什么我查询的时候总是跳到Index页面呢? 我自己也知道这个问题很那个啥...但作为新手...我也挺那个啥的.... --------------------编程问答-------------------- var user = from u in spms.members where u.password==password select u;
在这里下断点看看d、password是什么。
spms.members这个是用户表么?
为什么你只比对password,而不比对userid呢?
这代码写得什么。。。 --------------------编程问答-------------------- 因为你的user的count等于0啊……
原因的话暂时不知道 也是是数据库里没数据 也许是其他的 没其他的代码的话不得而知
不过对查找密码相同的用户组的做法……不得不说很神奇 尤其是action名叫做login
请问你是要做什么呢?
补充:.NET技术 , ASP.NET