我每次运行我的代码时都对此有问题..这是我的代码:
SqlConnection con = new SqlConnection("DataSource=SQLSERVER;Bar_login; Integrated Security = True");
DataTable dt = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter("select * from Bar_login where username = '" + txtuser.Text + "' and password ='" + txtpass.Text + "' ", con);
sda.Fill(dt);
if (dt.Rows.Count == 1)
{
MessageBox.Show("Login Succesfully");
}
else
{
MessageBox.Show("Wrong Username and Password");
}
它可以成功运行,但是在登录过程之后。
未处理。.“ System.ArgumentException:'不支持的关键字:'datasource'。'”。
有人可以帮忙吗?
连接字符串中的“数据”和“源”之间应该有一个空格。关键字是“数据源”,而不是“数据源”。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句