using System.Data.SqlClient;
SqlConnection myconn = new SqlConnection("server=LAPTOP-0LGEPDGC\\SQLEXPRESS;Trusted_Connection=SSPI;database=User");
SqlCommand mycomm;
SqlDataReader mydr;
private void btnFPwd_Click(object sender, EventArgs e)
{
try
{
if (myconn.State == ConnectionState.Closed)
{
myconn.Open();
}
mycomm = new SqlCommand("select userPwd from userTable where userName = '" + txtFindName.Text.Trim() + "'", myconn);
mydr = mycomm.ExecuteReader();
if (txtFindName.Text == "")
{
MessageBox.Show("用户名不可为空!");