在if(user.Count()> 0)“底层提供程序在打开时失败"上出现错误.请帮我. ThanX [英] Got an error on if(user.Count() >0) "The underlying provider failed on Open" plz help me with this. ThanX
本文介绍了在if(user.Count()> 0)“底层提供程序在打开时失败"上出现错误.请帮我. ThanX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
namespace SalesAndMonitoring
{
public partial class frmLogin : Form
{
private string User = "";
private bool isvalid = false;
private string[] privileges;
public string[] Privileges
{
get { return privileges; }
}
public string getUser
{
get { return User; }
}
public bool isValid
{
get { return isvalid; }
}
private void sValidate()
{
var user =
BusinessAccessLayer.GetEntity().User_tbl.Where(
e => e.UserID == txtUsername.Text && e.Password == txtPassword.Text);
if(user.Count() >0)
{
isvalid = true;
User = txtUsername.Text;
Close();
return;
}
MessageBox.Show("Invalid username or password", "invalid", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public frmLogin()
{
InitializeComponent();
txtUsername.Focus();
}
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult rs = MessageBox.Show("Are you sure you want to exit?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (rs == DialogResult.No) { return; }
Application.Exit();
}
推荐答案
数据库连接未正确连接.数据库连接被延迟,直到您实际从中请求数据为止,这就是为什么有关它的错误要晚一些的原因.
祝你好运!
The database connection isn''t connected correctly. The database connection is postponed until you actually request data from it, that''s why the error about it is a little late.
Good luck!
这篇关于在if(user.Count()> 0)“底层提供程序在打开时失败"上出现错误.请帮我. ThanX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文