110,571
社区成员
发帖
与我相关
我的任务
分享
private void button1_Click(object sender, EventArgs e)
{
string connstring="Data Source=.;Initial Catalog=new;Integrated Security=true;";
using (SqlConnection conn = new SqlConnection(connstring))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand("select count(*) from Tab where id='" + textBox1.Text+ "' and password='" + textBox2.Text + "'", conn))
{
if (cmd.ExecuteNonQuery() > 0)
{
MessageBox.Show("good");
}
else
{
MessageBox.Show("bad");
}
}
}
}