谁帮我看下这个为什么错了
//。。。。。。。。。。。。。省略
//连接数据库
string xname = namebox.Text;
string xpassword = passwordbox.Text;
SqlConnection tosql = new SqlConnection("Data Source=.;Initial Catalog=da1;Integrated Security=True");
tosql.Open();
string str = "select * from test where name =" + xname + "and password =" + xpassword;
SqlCommand sql_cmd = new SqlCommand(str,tosql);
SqlDataReader result = sql_cmd.ExecuteReader();
if (result.Read())
{
MessageBox.Show("登陆成功!");
}
else
{
MessageBox.Show("登陆失败!");
}
tosql.Close();
result.Close();
//。。。。。。。。。。。。。省略