string LoingName= textBox1.Text;
SqlConnection conn = new SqlConnection("server=.;database=中移建设综合资料查询系统;uid=sa;pwd=123");
conn.Open();
string sql = "select * from Loing where LoingName='" + LoingName + "'";
SqlCommand cmd = new SqlCommand(sql, conn);
object b = cmd.ExecuteScalar();
string a = Convert.ToString(b);
if (a == LoingName)
{
MessageBox.Show("登录成功");
}
else
{
MessageBox.Show("登录失败");
}