mdf成功附加数据库,vs2019连接数据库测试成功,软件运行却打不开数据库。请问什么原因??

#数据源

img

#vs2019 数据源连接测试成功 运行出错

img

img


```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();
        }

```

建议列名不要写中文。

你点开第一张图的表,看看表 TABLE_1 有没有工号和密码栏