第一:
SqlCommand myCommand=new SqlCommand("select username from user where username=@username ",myConnection); myCommand.Parameters.Add(new SqlParameter("@username", SqlDbType.NVarChar,50));
myCommand.Parameters["@username"].Value = username.Text;第二:
SqlCommand myCommand=new SqlCommand("select username from user where username='"+username.Text+"'",myConnection);效率上哪个好?