using System.Data.SqlClient;
using System.Configuration;//首先在资源管理器的"引用"里引用System.configuration文件
private void button1_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["connectionstring"].ToString();
string sqlstr = "select count(*) from adm where(Auname='"+maskedTextBox1.Text+"'and Apw='"+maskedTextBox2.Text+"')";
SqlCommand cmd = new SqlCommand(sqlstr,conn);
conn.Open();
int flag = System.Convert.ToInt32(cmd.ExecuteScalar());
conn.Close();
if (maskedTextBox1.Text == "")
{
MessageBox.Show("用户名不能为空");
}
else if (maskedTe