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