public int Login(Models.user m_user)
{
ConnectionStringSettings cnSetting =
ConfigurationManager.ConnectionStrings["ConnectionString"];
int res = -1;
using (SqlConnection conn = new SqlConnection())
{
//conn.ConnectionString = "server=localhost;database=login;Trusted_Connection=true;";
//conn.Open();
string uid, pwd;
uid = m_user.Id;
pwd = m_user.Pwd;
conn.ConnectionString = cnSetting.ConnectionString;
SqlCommand cmd = conn.CreateCommand();
string sql = "select * from Adm_Info where uid=@uid and pwd=@pwd";
cmd.Parameters.AddWithValue("@uid", uid);//这里出错,@uid必须声明标量变量
cmd.Parameters.AddWithValue("@pwd", pwd);
conn.Open();
怎么办,在网上查了半天也没发现对我这个问题有帮助的。