SqlCommand com = new SqlCommand("select count(*) from loginInfo where Name= @name and Pass=@ps", con);
                com.Parameters.Add(new SqlParameter("@name", SqlDbType.VarChar, 50));
                com.Parameters["@name"].Value = TextName.Text;
                com.Parameters.Add(new SqlParameter("@ps", SqlDbType.VarChar, 50));
                com.Parameters["@ps"].Value = FormsAuthentication.HashPasswordForStoringInConfigFile(TextPass.Text, "MD5");

 SqlParameter表示SqlCommand的参数

 

    }

 

 

相关文章: