本文介绍了如何编写select语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
因为标量变量必须在电子邮件中获得错误public DataSet logindetailsDAl()
{
try
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings [ MyConsString]。的ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand( SELECT * FROM资源WHERE电子邮件= @电子邮件,密码= @密码和OrganisationID = @ OrganisationID,con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
return ds;
}
catch (例外情况)
{
throw ex;
}
}
解决方案
i m getting error as scalar variable must be at email
public DataSet logindetailsDAl() { try { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConsString"].ConnectionString); con.Open(); SqlCommand cmd = new SqlCommand(" SELECT * FROM resource WHERE Email=@Email, Password=@Password and OrganisationID=@OrganisationID", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); return ds; } catch (Exception ex) { throw ex; } }
解决方案
这篇关于如何编写select语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!