小编Ofi*_*ten的帖子

System.ArgumentException:'不支持关键字:'datasource'.'

我每次运行我的代码时都遇到问题..继承我的代码:

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");
}
Run Code Online (Sandbox Code Playgroud)

它成功运行但在登录过程之后..这是一个例外

unhandled .."System.ArgumentException:'不支持关键字:'datasource'.'".

有人可以帮忙吗?

c#

2
推荐指数
1
解决办法
213
查看次数

-1
推荐指数
1
解决办法
2926
查看次数

标签 统计

c# ×1

database ×1

datatable ×1

sql-server-2008 ×1

table-rename ×1