SqlConnectionStringBuilder sb1 = new SqlConnectionStringBuilder();
sb1.DataSource = "(local)";
sb1.InitialCatalog = "lyy";
sb1.IntegratedSecurity = true;
sb1.PersistSecurityInfo = true;
sb1.AsynchronousProcessing = true;
sb1.MultipleActiveResultSets = true;
conn1 = new SqlConnection(sb1.ConnectionString);
conn1.Open();
cmd1 = new SqlCommand();
cmd1.Connection = conn1;
cmd1.CommandText = "select name,pwd from [user] where name='" +this.textBox1.Text + "'";
int count = cmd1.ExecuteNonQuery();
if (count <= 0)
{
MessageBox.Show("用户名或密码错误!!", "提示窗口", MessageBoxButtons.OK, MessageBoxIcon.Information);
i += 1;
if (i >= 3)
button2.PerformClick();
return;
}
判断查询是否有数据,应该是怎么写的,我这个是哪里错了?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货