它给我GetLoginDataSet中的错误SqlParameter已包含在另一个SqlParameterCollection中. [英] it gives me error in GetLoginDataSet The SqlParameter is already contained by another SqlParameterCollection.
本文介绍了它给我GetLoginDataSet中的错误SqlParameter已包含在另一个SqlParameterCollection中.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
protected void btnSave_Click(object sender, ImageClickEventArgs e)
{
try
{
DataSet ds = new DataSet();
//objLogin.Mode = 2;
objLogin.LoginId = Convert.ToInt32(Session["LoginId"].ToString());
ds = objLogin.GetLoginDataSet();
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
{
if (txtOldPassword.Text == ds.Tables[0].Rows[0]["Password"].ToString())
{
string ABC = txtNewPassword.Text;
if (txtConfirmPwd.Text == ABC)
{
objLogin.Password = txtNewPassword.Text;
objLogin.ConfirmPassword = txtConfirmPwd.Text;
objLogin.LoginId = Convert.ToInt32(Session["LoginId"].ToString());
objLogin.IsActive = 1;
objLogin.IsDeleted = 0;
objLogin.UpdatedBy = Convert.ToInt32(Session["LoginId"].ToString());
objLogin.UpdatedDate = Convert.ToDateTime(System.DateTime.Today.ToString()).ToString("yyyy/MM/dd");
int result = objLogin.InsertPwdData();
if (result > 0)
{
txtNewPassword.Text = string.Empty;
txtConfirmPwd.Text = string.Empty;
txtOldPassword.Text = string.Empty;
ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Password Changed Sucessfully');", true);
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Data not Saved');", true);
}
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Password Doesn't Match');", true);
}
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Current Password is Incorrect');", true);
}
}
}
catch { }
}
public DataSet GetLoginDataSet()
{
try
{
SqlParameter[] P = new SqlParameter[3];
P[0] = new SqlParameter("@LoginId", LoginId);
P[1] = new SqlParameter("@LoginName", LoginName);
P[2] = new SqlParameter("@Password", Password);
//return sqlHelper.ExecuteDataset(ClsConnection.ConnectionString, "Select Password from LoginMaster where LoginId='" + LoginId + "'", P);
return sqlHelper.ExecuteDataset(ClsConnection.ConnectionString, CommandType.StoredProcedure, "SP_LoginMaster", P);
}
catch
{
return null;
}
}
推荐答案
在此处检查类似的线程
错误:SqlParameter已被另一个SqlParameterCollection包含. [ ^ ]
Check similar thread here
Error : The SqlParameter is already contained by another SqlParameterCollection.[^]
这篇关于它给我GetLoginDataSet中的错误SqlParameter已包含在另一个SqlParameterCollection中.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文