#数据源
#vs2019 数据源连接测试成功 运行出错
```c#
private void blogin_Click(object sender, EventArgs e)
{
string constr = "Data Source=DESKTOP-K6B5IIK\\SSQL;Initial Catalog=停车管理;Integrated Security=True";
SqlConnection conn = new SqlConnection(constr);
string commandstr = "SELECT * FROM TABLE_1 WHERE 工号='" + tname.Text + "'and 密码='" + tpasswd.Text + "'";
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(commandstr, conn);
da.Fill(dt);
conn.Open();
if (dt.Rows.Count > 0)
{
string name = tname.Text;
MessageBox.Show(string.Format("工号"+tname.Text+"登录成功!"));
Form2 f2 = new Form2();
f2.ShowDialog(this);
// this.Hide();
}
else
MessageBox.Show(string.Format("用户名或密码错误,登录失败"));
conn.Close();
}
```